NEWLINE character problem

Dragos Chirila d.chirila at finsiel.ro
Fri Jan 30 09:16:12 EST 2004


Hi

I have a string and I want to split it by NEWLINE character.

It is knowned that "Microsoft Windows, Apple's Macintosh OS and various
UNIX, all use different characters to mark the ends of lines in text files.
Unix uses the linefeed (ASCII character 10), MacOS uses the carriage return
(ASCII character 13), and Windows uses a two-character sequence of a
carriage return plus a newline". So, PLEASE don't tell me to use 'split' by
'\n' because it won't work.

I know about the Python support, opening files with 'U' flag, for reading in
universal newline mode. But this is not the case. My script receives a
string, can be the content of a file text from Windows or Unix system. I
want to make sure that I can split this string by NEWLINE character.

Any idea will be appreciated.
Thanks a lot.

Dragos






More information about the Python-list mailing list