text file
Dave Harrison
dlharris at mail.usyd.edu.au
Sun Dec 15 15:41:35 EST 2002
Curt,
File ops are built natively into python, no module necessary.
A file object is created as :
f = file('foo')
or for pre2.2 python
f = open('foo')
You can then read lines out by calling f.readlines() which will return you a list of the lines of the file.
Writing elsewhere is very similar but using a write flag at the time when you create the file object.
Cheers
Dave
C. Dunlap (webguy at netpath-rc.net):
> I want to be able to randomly pull four lines of text out of a file and
> write those four lines to another file.
>
> Are there any tutorials available on the web that will point me in the
> right direction? Would I use a module to accomplish this task?
>
> Thanks in advance for your help.
>
> Curt
>
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list