Home

On Wed, 12 Sep 2007 17:28:08 -0500, "Shankarjee Krishnamoorthi"
<shankarjee@gmail.com> declaimed the following in comp.lang.python:

> I would prefer to use something with seek. I am not able to use seek()
> with "for line in inp". Use tell and seek does not seem to do anything
> with the code. When I try to do
>
> for line in inp.readlines():

.readlines() does just what is says -- it reads ALL lines at once.
Once it has done this, .tell() will return the EOF.

for line in inp:

will read one line at a time (I'm fairly sure the iterator doesn't
attempt to buffer multiple lines behind the scenes)
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com wulfraed@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: web-asst@bestiaria.com)
HTTP://www.bestiaria.com/

previous
next

Re: how to identify the number of calls of a fuction
Re: Xah's Edu Corner: Under the spell of Leibniz's dream
Re: check whether internet connection is live from c++
Re: Differences in code implemented using this pointer and a variable THIS simulating this pointer
Re: Delete values from a string using the index
Akogo
Pajacyk
Fundacja Hobbit
Krwinka
Dzieci Niczyje