How 2 invoke python 2 read from text file under W2k

David Lees debl2NonoNospammy at bellatlantic.net
Sat Dec 15 17:10:17 EST 2001


You might find it easier to use an IDE for writing code, such as
PythonWin.  I like PythonWin, but that is personal preference.

You can obtain the PythonWin distribution from Activestate at:
http://www.activestate.com/Products/ActivePython/
Under PythonWin, start it up and then go to the menu, select 'New' and
then 'Python Script'.  Type your Python code into the editing window. 
Save it and then run it by using the 'Run' iten on the 'File' menu. 
There are shortcuts, such as 'ctrl-R' or just pushing the run icon on
the PythonWin toolbar.

Under IDLE, fire it up and then chose the 'New Window' item on the file
menu.  Enter your code in the new window, save using the 'save' item on
the file menu and run using the 'Run script' item on the 'Edit' menu (or
use the shortcut 'ctrl-F5').  Note that the interface on IDLE is a bit
different than PythonWin, because each new window has its own menu,
while PythonWin has a single menu on the main screen.

Hope this helps,

David Lees


Tom Karas wrote:
> 
> 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