Readline and record separator

Johny python at hope.cz
Wed Oct 31 05:02:57 EDT 2007


On Oct 30, 8:44 pm, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> Johny a écrit :
>
> > Is it possible to change record separator when using readline?
> > As far as I know readline reads characters until found '\n' and it is
> > the end of record for readline.
>
> This is not a "record" separator, but a newline. As the name implies,
> file.readline is about reading a text file line by line. For a
> definition of "line" being : "a chuk of text that starts either at the
> beginning of the document or after a newline" and for a definition of
> "newline" being "a platform-specific character or character sequence".
>
> > My problem is that my record consits several '\n' and when I use
> > readline it does NOT read the whole my record.
> > So If I could change '\n' as  a record separator for readline, it
> > would solve my problem.
> > Any idea?
>
> If you're dealing with (so-called) CSV files, you might want to have a
> look at the (oh surprise) CSV module (in the stdlib) instead.
>
> HTH

Bruno,
Thank you for your hint, but can you please be more specific when
saying
"look at the (oh surprise) CSV module (in the stdlib)" ?
Thanks
L




More information about the Python-list mailing list