Using readline with a new delimiter of line ?

remco remco at localhost
Mon Dec 15 08:39:02 EST 2003


"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