string literals in windows dont show up!
Chris Liechti
cliechti at gmx.net
Wed Nov 21 19:44:33 EST 2001
More information about the Python-list mailing list
Wed Nov 21 19:44:33 EST 2001
- Previous message (by thread): string literals in windows dont show up!
- Next message (by thread): string literals in windows dont show up!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[posted and mailed] "Chris Fonnesbeck" <fonnesbeck_chris at yahoo.com> wrote in news:mailman.1006383692.28423.python-list at python.org: > I am trying to append literals (i.e. \n, \r) to the end of lines in a > text output file. However, when the file is brought up in the windows > notepad, there is no line feed or carriage return. Any idea about how > to make windows recognize these literals. Works fine in linux (no big > surprise there!) > > Thanks > Chris Fonnesbeck > if you use the "b" modes under windows [eg. open(filname,"wb")] the data is written as you write it, no conversion (b for binary data). but if you specify only "w" (or "r") cr-lf <-> lf transformation is done. (on linux/unix no such conversion is needed as "\n" is the linefeed which is the natural line break on these OS) this should write two lines, on windows with cr-lf line endings >>> open("test.txt","w").write("line1\nline2\") does this help? if not, try to post a small python example to illustrate your problem. chris -- Chris <cliechti at gmx.net>
- Previous message (by thread): string literals in windows dont show up!
- Next message (by thread): string literals in windows dont show up!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list