How 2 invoke python 2 read from text file under W2k
Tom Karas
Tom.Karas at htp-tel.de
Sat Dec 15 16:21:19 EST 2001
Hello World,
in the tutorial: "Instant Hacking" theres is this little programm: "#
Area calculation program". Which apparently must be written into a text
file and then somehow the python interpreter as to "compile" this file.
My problem is, that i do not know how to tell python to read a text.file
and to "compile" it.
I read the following lines of the "Python Tutorial" from Guido van
Rossum a.o. and tried both solutions under Windows 2000 to use a
text.file as input source - but none of them worked.
Quotation from the tutorial:
"Note that there is a difference between "python file" and "python
<file".
In the latter case, input requests from the program, such as calls to
input() and raw_input(), are satisfied from file. Since this file has
already been read until the end by the parser before the program starts
executing, the program will encounter end-of-file immediately.
In the former case (which is usually what you want) they are satisfied
from whatever file or device is connected to standard input of
the Python interpreter"
Any help even a link which explains the necessary steps to use text
files as input source for the python interpreter under win2000 would be
really appreciated.
Best regards
Tom Karas
More information about the Python-list
mailing list