Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '16,': 0.03; 'string': 0.09; 'apis': 0.09; 'subject:extra': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'windows': 0.15; "'/'": 0.16; 'backslashes': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'igor': 0.16; 'subject:variable': 0.16; 'too).': 0.16; 'underlying': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'replace': 0.24; 'skip:l 30': 0.24; 'fine': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'convert': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'so,': 0.37; 'pm,': 0.38; 'subject:" ': 0.39; 'how': 0.40; 'most': 0.60; 'forward': 0.65; 'world': 0.66; 'anything.': 0.68; 'realized': 0.68; 'those?': 0.84; 'same,': 0.91; 'to:none': 0.92; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=dg+Hw6kmjltOEqkxdLm3GCQ9zKePravsO2g75KcFDco=; b=fQC+LPu7s0UNMt8cyohFkNKeDG1csrIPkUPQrqiyCNlbQaI4mxr3e5aj1qIPicRUoS y99SRC2v2wUwNN85R5lL5t/kD1lesiT5UN1G18T1+u3Esoa0449m7V4xb6+7l4JOt0KS 1TYp8ZuRlO9Vg3umd8MvAOpQbW+tPEDSm4fdBVSvh4+WoNxpeS3A7CPTjr97AuAlBYeJ Hgy0qKVsHXEoCLTbBe9yVFKj9ASkITfJ1qBYk/Lx0DmxCavTqDWeeKCKNl62DKgi8dnd XbuP44D+tB4Q01/fUC0FeIjeuf+BjcWOVRFMKmXj2h7moCbTgNvM8Oz0F66GTxXAy9i3 yWOQ== MIME-Version: 1.0 X-Received: by 10.68.108.194 with SMTP id hm2mr17767365pbb.22.1387162644190; Sun, 15 Dec 2013 18:57:24 -0800 (PST) In-Reply-To: References: <52A25D94.9040404@islandtraining.com> <20131208125823.241112db@bigbox.christie.dr> <20131208161858.1365f2d7@bigbox.christie.dr> <20131215061720.2fbb394d@bigbox.christie.dr> <20131215062923.184bf636@bigbox.christie.dr> <52AE5037.5000300@mrabarnett.plus.com> Date: Mon, 16 Dec 2013 13:57:24 +1100 Subject: Re: Eliminate "extra" variable From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387162653 news.xs4all.nl 2844 [2001:888:2000:d::a6]:40559 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61988 On Mon, Dec 16, 2013 at 1:43 PM, Igor Korot wrote: > So, how do I convert my string to one of those? > I realized I can just do replace '/' to '\', but is there a better alternative? The path is exactly the same, whether you use forward slashes or backslashes, on Windows. Most of the world uses backslashes for Windows paths, but forward slashes do work fine (and that's not a Python thing - the underlying APIs work with / just fine too). So you don't have to actually replace anything. >>> len(open("c:/Festival2013.txt").read()) 79137 ChrisA