Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'character,': 0.07; 'backslash': 0.09; 'parsing': 0.09; 'subject:Problem': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'filenames': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'said.': 0.16; 'string:': 0.16; 'mon,': 0.16; 'written': 0.17; 'linux': 0.18; 'received:209.85.210.174': 0.19; 'received:mail- iy0-f174.google.com': 0.19; 'help.': 0.19; 'work,': 0.20; 'header :In-Reply-To:1': 0.22; 'literal': 0.23; 'code': 0.24; 'string': 0.26; 'windows': 0.26; 'work.': 0.28; 'character': 0.28; 'message- id:@mail.gmail.com': 0.28; 'code,': 0.29; 'character.': 0.30; 'differences': 0.30; "won't": 0.32; 'chris': 0.32; 'skip:" 20': 0.33; 'to:addr:python-list': 0.34; 'skip:" 10': 0.36; 'file': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'run': 0.39; 'goes': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'raw': 0.40; 'skip:r 20': 0.40; 'your': 0.60; 'special': 0.67; 'share': 0.68; 'subject:!!': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=oOHmltB9qQY7OuNyltPT2za49elxX3UXjlxPsQ1gRtM=; b=S1TWi0OzyEgr4pfMMC6cYHSCEzAVS/T9oJBwfRpj90a33NKTr/JQMr6K7iTwEwNiaC K7yYRgGzx/Bttv3fbna4GsEbQszl1vgP+1UN/ehYdyR6HHtMYNPV5VWsIiAVqJacrces U8yOu0ijK3nYjGyXr48IuWiNNZbsqcdHSB99I= MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 4 Jul 2011 09:54:28 +1000 Subject: Re: Problem!! From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309737271 news.xs4all.nl 21810 [2001:888:2000:d::a6]:47790 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8747 On Mon, Jul 4, 2011 at 9:41 AM, amir chaouki 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