Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python error get line

import sys
try:
    print(5/0)
except Exception as e:
    print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno), type(e).__name__, e)

print('And the rest of program continues')
Comment

exception get line number python

import traceback

try:
    print(4/0)
except ZeroDivisionError:
    print(traceback.format_exc())
Comment

PREVIOUS NEXT
Code Example
Python :: python list contains string 
Python :: python sliding window 
Python :: how to stop thread python 
Python :: pairwise function python 
Python :: check datatype python 
Python :: how to add reaction by message id in discord.py 
Python :: What will be the output of the following program? 
Python :: optimize images using pillow 
Python :: pandas pivot to sparse 
Python :: how to generate random number in python 
Python :: flask run 
Python :: channel hide command in discord.py 
Python :: anagrams string python 
Python :: listas en python 
Python :: Group by a column, count sum of other columns 
Python :: converting datatypes 
Python :: Multidimensional Java Array 
Python :: python dash log scale button 
Python :: python how to remove n from string 
Python :: make gif from images in python 
Python :: How to take multiple input form python 
Python :: WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. 
Python :: remove empty string from list python single line 
Python :: function to remove punctuation in python 
Python :: python script that turns bluetooth on 
Python :: check if any letter in string python 
Python :: python remove a character from a string 
Python :: how to append to a list in python 
Python :: how to get more than one longest word in a list python 
Python :: string equals python 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =