On Fri, Feb 27, 2009 at 12:20 PM, Scott David Daniels
<scott.dani...@acm.org> wrote:
> (1) Please do not top post in comp.lang.python, it violates conventions.
>
> Brett Hedges (should have written):
>> bearophile wrote: ...
>>>
>>> You can also keep track of the absolute position of the lines in the
>>> file, etc, or step
>
>>> back looking for newlines, etc, but it's not handy....
>>
>> How would I keep track of the absolute position of the lines?
>
>> I have tried to use the files.seek() command with the files.tell()
>> command and it does not seem to work. The files.tell() command seems
>>  to give me a number but when I use the files.next() command with
>> xreadlines it does not change the line number the next time I use
>> files.tell().
>
> The answer to your question depends on what version of Python you are
> running.  Give python version and platform to any question when you
> don't _know_ they are irrelevant.
>
> If you want an answer without any other input, try this:
>
> The simplest way to solve this for the moment is (re)defining
> xreadlines:
>
>    def xreadlines(source):
>        for line in iter(src.readline, ''):
>            yield line
>
> --Scott David Daniels
> scott.dani...@acm.org
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Sorry for top-posting.
http://en.wikipedia.org/wiki/Posting_style
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to