On Oct 8, 2010, at 9:33 PM, Dennis Lee Bieber wrote:

On Fri, 8 Oct 2010 14:52:33 -0700, aurfal...@gmail.com declaimed the
following in gmane.comp.python.general:

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")

        Why are you opening in "a"ppend? If you want to create a new file
containing the edited contents of the input file, just open "w".


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

        In Windows WHAT? Notepad, Wordpad, Word, a command console using
"type".

Geez man, relax. I thought it was obvious by the code that I was opening it using Python.

I changed a to w and added a b, so all is well now, ie:  "wb"

Still don't know why Windows treats text files as binary files but using wb worked well.

- aurf
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to