On Jul 31, 7:26 am, alex23 <[EMAIL PROTECTED]> wrote:
> kj wrote:
> > Sorry, I should have googled this first.  I just found splitlines()...
>
> > Still, for my own edification, is there a way to achieve the same
> > effect using re.split?
>
> re.split(os.linesep, <string>) works the same as <string>.splitlines()
>
> Neither retain the EOL for each line, though. The only way I'm aware
> of is to re-add it:
>
> [s+os.linesep for s in re.split(os.linesep, <string>)]
>
> Was that what you were after?

or what about 'string'.splitlines(True) as that retains newline
characters. ;)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to