rosuav at gmail.com
Mon Jul 4 01:54:28 CEST 2011
On Mon, Jul 4, 2011 at 9:41 AM, amir chaouki <chaouki.amir at gmail.com> wrote:
> i have written code on linux for parsing text files and it works great
> but when i try to run it on windows it goes crazy, do you have any
If you share your code, we may be able to help. Alternatively, here's
a few differences to look at:
1) Filenames - if you have a literal for your file name,
"/home/foobar/file" will work, but "c:\path\newfile.txt" won't -
backslash is a special character. Make it a raw string:
r"c:\path\newfile.txt" - that will work.
2) End of line characters. If you divide the contents of the file on
the "\n" character, and then try to work with the end of each line,
you may find that the string has a "\r" character at the end.
3) What Irmen de Jong said. :)
More information about the Python-list