Newbie question : string processing with RE

Syver Enstad syver at
Wed Mar 28 00:12:03 CEST 2001

<Patrick.Bussi at> wrote in message
news:mailman.985707278.14550.python-list at

>But when I try to read it again, it acts as if the index of
> a file had to be "rewinded" (e.g. as would do a "seek" on a "true" file).
Yes, that is correct, it is a file object (not a disk file in this case) and
it behaves like a file.
> thought that was to be considered as a string.
Yes, and no, returns a string that is the whole file from the
point in the file where you are to the end. But this means that the next
time you call read on the file it will be at the end and return the empty

If you want to search the string twice you'll have to keep the string
returned by read, like this:

content =

Then you can use content as many times as you like.

More information about the Python-list mailing list