Here is an example codes to use exception to display abnormal error
import traceback
kkk = [1,2,3,4]
for index in range(2,-1,-1):
try:
print(kkk[index+2])
except:
traceback.print_exc()
print('traceback.format_exc():\n%s' % traceback.format_exc())
Read More:
- Python uses try… Except… To output detailed errors
- Python: How to Use os.path.join()
- Python ProgressBar adds its own dynamic information to the progress bar
- Python+OpenCV: How to Use Background Subtraction Methods
- [Solved] PyCharm pytest-html Install Error: Try to run this command from the system terminal. Make sure that you use
- How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)
- How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow
- Python: How to get the size of the picture (byte/kb/mb)
- Python3.7 Capture exception error: Too broad exception clause
- How to Solve Python Xlwt ValueError: More than 4094 XFs (styles)
- Python: How to Create an Automatic Recording Program
- An introduction to sys modules in Python and how packages are imported and used
- Python: How to Solve error While importing windpy
- [Solved] python Error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.
- How to Fix keyerror in Python dictionary lookup
- python2.7 ExcelWriter error Exception caught in workbook destructor. Explicit close() may be require
- Python: How to parses HTML, extracts data, and generates word documents
- Python Use sqlalchemy Error: pymssql.ProgrammingError: (102, b“Incorrect syntax near ‘(‘.DB-Lib error
- How to Fix “HTTP error 403: forbidden” in Python 3. X
- Python Use PIP to install pyinstaller Error [Solved]