I'm learning Python and don't know where I can find in the docs the potential errors raised by a dictionary or list call.
For instance:
d_maxtempm = d_summary[1]['maxtempm']
d_date = parsed_json['history']['date']
can raise a IndexOutOfBound or Key error ?
But where is the complete list so i can fully implement my error handling ?
The list of Built-in Exceptions can be found in the Python documentation.
You can check http://docs.python.org/2/library/exceptions.html for all the exceptions.
Dictionary can raise: KeyError : http://docs.python.org/2/library/exceptions.html#exceptions.KeyError
Lists can raise: IndexError : http://docs.python.org/2/library/exceptions.html#exceptions.IndexError
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.