[Python-Dev] Re: Unix line endings required for PyRun* breaking embedded Python
Skip Montanaro
skip at pobox.com
Thu Jan 20 13:51:41 CET 2005
More information about the Python-Dev mailing list
Thu Jan 20 13:51:41 CET 2005
- Previous message: [Python-Dev] Re: Unix line endings required for PyRun* breaking embedded Python
- Next message: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fredrik> s = s.replace("\r", "\n"["\n" in s:])
This fails on admittedly weird strings that mix line endings:
>>> s = "abc\rdef\r\n"
>>> s = s.replace("\r", "\n"["\n" in s:])
>>> s
'abcdef\n'
where universal newline mode or Just's re.sub() gadget would work.
Skip
- Previous message: [Python-Dev] Re: Unix line endings required for PyRun* breaking embedded Python
- Next message: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list