What is the difference between \',\' and \'as\' in except statements, eg:
try:
pass
except Exception, exception:
pass
and:
As of Python 3.7 (not sure about other versions) the 'comma' syntax is not supported any more:
Source file exception_comma.py
:
try:
result = 1/0
except Exception, e:
print("An error occurred")
exit(1)
exit(0)
$ python --version --> Python 2.7.10
$ python exception_comma.py
An error occurred
$ python3 --version --> Python 3.7.2
$ python3 exception_comma.py
File "exception_comma.py", line 3
except Exception, e:
^
SyntaxError: invalid syntax