"Prasad Mehendale" <prachit...@gmail.com> wrote
I am a beginner. I want to save the output data of the following programme
in
a file through the programme.
The easiest way is to use file redirection at run-time
$ python foo.py > results.txt
This will work on Linux/MacOS/Windows
The alternatives are
1) open a file in your program and replace all of the print statements
with write() functions
2) Use the file output trick with print
resultFile = open('results.txt',w)
print >>resultFile 'my output string'
You can find out more about file handling in the Handling Files topic of
my tutorial ...
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor