script in Linux vs Windows



Hi all,

Unsure how to deal with what appears to be \n vs \r issues.

The following code works in Linux;

o = open("axenfs.reg")
n = open("axenfs2.reg", "a")
while 1:
line = o.readline()
if not line: break
line = line.replace("dword:00000","dword:0000044e")
n.write(line)
n.close()

But in Windows, its one continues line with a bunch of squares in it.

So I add + '\r\n' to my second to last line so it looks like;

n.write(line + '\r\n')

But I still get one continuous line with squares in it.

Any ideas? I've been googing all day to no avail.

Desperately seeking advice.

- aurf
.



Relevant Pages

  • script in Linux vs Windows
    ... Unsure how to deal with what appears to be \n vs \r issues. ... The following code works in Linux; ... its one continues line with a bunch of squares in it. ...
    (comp.lang.python)
  • Re: script in Linux vs Windows
    ... Unsure how to deal with what appears to be \n vs \r issues. ... The following code works in Linux; ... its one continues line with a bunch of squares in it. ... Open the input file in binary mode and print out the repr for a few ...
    (comp.lang.python)
  • Re: Help with SUSE 9.0 Network Connection?
    ... Here, device type is shown to be PPPOE, server type is ... I am unsure to make all this work in Linux. ...
    (comp.os.linux.setup)
  • Re: firewire support
    ... I'm unsure from your posting if your drive is successfully connected? ... This script here should let you know if your drive is being handled ... correctly by linux. ...
    (comp.os.linux.hardware)
  • Re: FreeBSD 4.9 RC1 (i386) now available
    ... >> machine throws a handful of segfaults and boom. ... I'm unsure whether ... > This tends to imply hardware issues. ... If Linux showed weird behaviour as well, I would not have reported this. ...
    (freebsd-stable)