转发: How to exit program with custom code and custom message?

scruel tao scruelt at hotmail.com
Mon Mar 13 06:18:26 EDT 2023


Chris:
> It doesn't actually take a list of arguments; the square brackets
indicate that arg is optional here.

Oh, I see, it seems that I mistunderstood the document.

> but for anything more complicated, just print and then exit.
> It's worth noting, by the way, that sys.exit("error message") will
> print that to STDERR, not to STDOUT, which mean that the equivalent
> is:

Yes, I know, but don’t you think if `sys.exit` can take more parameters and have a default output channel selection strategy will be better?
Thanks.



More information about the Python-list mailing list