Input() in Python3
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Fri Apr 22 19:55:15 EDT 2011
On Sat, 23 Apr 2011 06:25:51 +1000, Chris Angelico wrote:
> On Sat, Apr 23, 2011 at 12:08 AM, Mel <mwilson at the-wire.com> wrote:
>> But sys.exit() doesn't return a string. My fave is
>
> It doesn't return _at all_. Boom, process terminated.
Technically it raises an exception, which can then be caught by the usual
exception-handling mechanism. So it's not quite Boom.
>>> try:
... sys.exit(42)
... except SystemExit as e:
... print(e.code)
...
42
>>>
--
Steven
More information about the Python-list
mailing list