[Tutor] how to run a text file in an interpreter?
Tonu Mikk
tmikk at umn.edu
Fri Mar 30 18:59:05 CEST 2007
Hello, I am new to the list and to programming in general. I want to
learn Python as I find it an interesting language. I also support an
application that is written in Python called Roundup
http://roundup.sf.net . I find that I would like to make small tweaks
to the program that require a knowledge of Python.
Now to my question. I started reading Instant Python tutorial (
http://hetland.org/writing/instant-python.html ) and came across this
section:
"/Note:/ To get the examples working properly, write the programs in a
text file and then run that with the interpreter; do /not/ try to run
them directly in the interactive interpreter - not all of them will work. "
I do not know what the author means by running a text file with the
interpreter. I noticed that I came across an obstacle early on in trying
out the code.
I tried writing
|first, second = second, first
into the PythonWin interpreter, but this resulted in the following error after pressing the return key:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
NameError: name 'second' is not defined
I imagine that I need to create a text file first and then run it with the interpreter. How do I do that?
Thank you,
Tonu
|
More information about the Tutor
mailing list