[Tutor] more about how I overcame not being able to run my programs

Alan Gauld alan.gauld at btinternet.com
Fri Mar 16 00:51:47 CET 2012


On 15/03/12 22:39, Tamar Osher wrote:

> try:
> import os
> # my program
> finally:
> input ('\n\t\t\tPress the enter key to continue.')
> os.system ('pause')

It's more conventional to put the import at the very top, before the 
try: line.

But otherwise what you have should be fine. There are other ways of 
doing it and eventually you may write programs that don't require the 
press enter... line and you can then miss out all of the code above. But 
for learning that's fine.

Or just run your programs inside IDLE or, as someone else suggested, 
Eclipse and PyDev (although personally that seems like overkill!)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list