stripping cr/lf, lf, cr

Lyle Johnson ljohnson at resgen.com
Tue Mar 27 11:16:06 EST 2001


> Is there a platform independant function that will remove appropriate EOL
> characters from a string?  I don't want to use strip() since it will also
> remove other whitespace I want to keep.

The standard Python source code distribution includes two scripts:

    Tools/scripts/lfcr.py
    Tools/scripts/crlf.py

that convert back and forth between DOS and Unix line endings. I don't know
if there are *specific* library functions dedicated to these tasks but it
shouldn't be much of a stretch to mine these scripts for what you need.





More information about the Python-list mailing list