script in Linux vs Windows

aurfalien at gmail.com aurfalien at gmail.com
Fri Oct 8 17:52:33 EDT 2010


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



More information about the Python-list mailing list