Using readline with a new delimiter of line ?

Laurent Laurent.Olivry at wanadoo.fr
Mon Dec 15 08:45:53 EST 2003


thanks for this
    Laurent

"remco" <remco at localhost> a écrit dans le message de news:
3fddb97c$0$217$e4fe514c at news.xs4all.nl...
> "Laurent" <Laurent.Olivry at wanadoo.fr> wrote:
>
> >is it possible to read a file in python line by line
> >by redefining a new end-of-line delimiter ?
> >
> >I would like for example to have the string "END" being the new delimiter
> >for each line.
> >
>
> i couldn't find any builtin option. But of course you could always use:
>
>
> listOfLines = file('<filename>','r').read().split('END')
>
> Cheers!
> remco






More information about the Python-list mailing list