Methods on file-like objects can only used once on one object?

Paul Kölle paul at subsignal.org
Tue Aug 23 11:28:11 EDT 2011


Am 23.08.2011 16:21, schrieb Yingjie Lin:
> Hi Python users,
[snip]

> There are quite a few methods for file-like objects that can only be used once on one object. If I prefer to use some of these methods on one object, one after another, like:
>
> f.readlines()
> f.read()
> ...
>
> What should I do? Thank you.
use f.seek(0) between calls. The python documentation will educate you 
about the details.

hth
  Paul




More information about the Python-list mailing list