saving a text file
bruno modulix
onurb at xiludom.gro
Mon Feb 14 05:08:23 EST 2005
Jan Rienyer Gadil wrote:
> any idea how to automatically save to a text file?
What does 'automatically' mean ?-)
AFAIK, the best way to write something to a file is to
* open the file in write mode
* write your data to the file
* close the file
Hopefully this is quite simple.
f = File('myfile.txt', 'w')
f.write(my_data)
f.close()
You'll of course need to add some code to handle IOErrors...
(snip)
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list