Message277657
I'm reading the Python 3.5.2 documentation at:
https://docs.python.org/3/tutorial/errors.html#handling-exceptions
which shows the following example:
>>> def this_fails():
... x = 1/0
...
>>> try:
... this_fails()
... except ZeroDivisionError as err:
... print('Handling run-time error:', err)
...
Handling run-time error: int division or modulo by zero
Running the code as a script produces:
$ python3 -V
Python 3.5.2
$ python3 p.py
Handling run-time error: division by zero
$ python2 -V
Python 2.7.12
$ python2 p.py
('Handling run-time error:', ZeroDivisionError('integer division or modulo by zero',))
The same output is listed for 3.6 and 3.7 tutorials but I don't have those
versions installed on my system. |
|
Date |
User |
Action |
Args |
2016-09-28 19:33:50 | viorel | set | recipients:
+ viorel, docs@python |
2016-09-28 19:33:50 | viorel | set | messageid: <1475091230.17.0.768129423451.issue28306@psf.upfronthosting.co.za> |
2016-09-28 19:33:50 | viorel | link | issue28306 messages |
2016-09-28 19:33:50 | viorel | create | |
|