Mailing List Archive

readline() with other delimiter
Hi all.

Is there a function similiar to readline(), but with other delimiters?
I have a program, which emits "\r" between the lines instead of "\n"

I wrote a little dumb function:

def myreadline(self):
line = ""
char = self.foo.read(1)
while not char in "\r\n":
line = line + char
char = self.foo.read(1)
line = line + "\n"
return line

But this seems not optimal...
It would be useful, if you could pass the delimiter as an argument to
readline()...

Any hints?

Bye,
Simon
--
Simon.Budig@unix-ag.org http://www.home.unix-ag.org/simon/
---===###===---
*** Online-Petition gegen unerwuenschte Werbe-E-Mail:
*** http://www.politik-digital.de/spam/