[Tutor] seeing the results of a python program in windows7
bob gailer
bgailer at gmail.com
Thu Mar 15 03:09:05 CET 2012
On 3/14/2012 12:12 PM, Tamar Osher wrote:
> Hi. I ask for help. Thanks very much for your time.
>
> I can run a python program in Notepad++, but what happens is that the
> black box flashes and disappears immediately, so that I never see the
> results.
If you expected anything else you don't understand how windows runs
programs.
> How can I style it so that the results of the program stay on the
> computer screen, for me to see?
Do this:
try:
# your program goes here
finally:
raw_input("Press any key")
# if you are running Python 3 replace raw_input with input
Adding the try-finally construct ensures that any exception in your code
will be visible.
--
Bob Gailer
919-636-4239
Chapel Hill NC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120314/8a8b55d9/attachment.html>
More information about the Tutor
mailing list