[Tutor] seeing the results of a python program in windows7
Brian van den Broek
brian.van.den.broek at gmail.com
Thu Mar 15 07:45:58 CET 2012
On 15 Mar 2012 04:14, "bob gailer" <bgailer at gmail.com> wrote:
>
> On 3/14/2012 12:12 PM, Tamar Osher wrote:
>> 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.
>>
>> 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.
>
Alternatively, invoke python to run your program at the prompt with the
interactive switch:
python -i myscript.py
Best,
Brian vdB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120315/79f90ee1/attachment.html>
More information about the Tutor
mailing list