Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8747
| References | <fa5036fe-ae67-4860-9f78-9469ad0c7b49@g12g2000yqd.googlegroups.com> |
|---|---|
| Date | 2011-07-04 09:54 +1000 |
| Subject | Re: Problem!! |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.590.1309737271.1164.python-list@python.org> (permalink) |
On Mon, Jul 4, 2011 at 9:41 AM, amir chaouki <chaouki.amir@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 > idea??? 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. :) Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem!! amir chaouki <chaouki.amir@gmail.com> - 2011-07-03 16:41 -0700
Re: Problem!! Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-07-04 01:47 +0200
Re: Problem!! TheSaint <nobody@nowhere.net.no> - 2011-07-04 15:16 +0800
Re: Problem!! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-04 20:48 +1200
Re: Problem!! rantingrick <rantingrick@gmail.com> - 2011-07-03 16:54 -0700
Re: Problem!! Chris Angelico <rosuav@gmail.com> - 2011-07-04 09:54 +1000
Re: Problem!! amir chaouki <chaouki.amir@gmail.com> - 2011-07-03 16:58 -0700
Re: Problem!! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-05 09:30 +1000
Re: Problem!! Nobody <nobody@nowhere.com> - 2011-07-05 09:14 +0100
Re: Problem!! Ben Finney <ben+python@benfinney.id.au> - 2011-07-04 10:12 +1000
Re: Problem!! Grant Edwards <invalid@invalid.invalid> - 2011-07-04 00:34 +0000
Re: Problem!! milosh zorica <miloshzorica@gmail.com> - 2011-07-03 21:57 -0300
csiph-web