regular expresson for Unix and Dos Lineendings wanted

gene tani gene.tani at gmail.com
Thu Feb 23 09:44:36 EST 2006


gene tani wrote:
> Franz Steinhaeusler wrote:
> >
> > Who can help me (regular expression, which works for both cases).
>
> universal newlines:
> http://www.python.org/doc/2.3.3/whatsnew/node7.html
> http://mail.python.org/pipermail/python-list/2006-February/324410.html

if multiple end-of line markers are present (\r, \r\n and or \n), use
the file's newlines attribute to see what they are.  I think the thread
linked above touched on that.  Otherwise newlines (or os.linesep)
should tell you what end of line is in that file.

http://docs.python.org/lib/bltin-file-objects.html




More information about the Python-list mailing list