[Tutor] Code to open a website

Steven D'Aprano steve at pearwood.info
Mon Feb 11 02:14:42 CET 2013


On 10/02/13 20:25, ALAN GAULD wrote:
>
>
>> Maybe the OP meant to say 'quit()' ? That does not require an import.
>
>
> Ooh! another option I didn't know about!
> So many ways to get rid of Python and here's me been importing sys
> or raising SystemExit all these years... :-)


exit() and quit() (as added by the site.py module) are for interactive use.
They're mostly there for the benefit of newbies. Experienced developers (at
least in the Unix/Linux world) usually know to exit interactive terminal
apps with Ctrl-D. I believe you use Ctrl-Z <enter> under Windows.

For programmatic use in scripts, use sys.exit(), since the site module is
not guaranteed to run.



-- 
Steven


More information about the Tutor mailing list