Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.92.MISMATCH!xlned.com!feeder5.xlned.com!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'sorts': 0.04; 'path,': 0.07; 'filename': 0.09; '>>>': 0.12; 'am,': 0.14; 'subject:file': 0.14; 'wrote:': 0.14; 'ha!': 0.16; 'kick': 0.16; 'pathname': 0.16; 'received:192.168.200': 0.16; 'cc:addr:python-list': 0.17; '(which': 0.20; 'header:In-Reply-To:1': 0.21; 'file,': 0.22; 'cc:2**0': 0.22; 'stuff': 0.22; 'cc:no real name:2**0': 0.23; 'tried': 0.27; 'skip:" 30': 0.29; '24,': 0.29; 'cc:addr:python.org': 0.30; 'appended': 0.30; 'tjg': 0.30; 'it.': 0.31; 'equal': 0.31; 'greatly': 0.33; "i've": 0.33; 'there': 0.35; 'header:User-Agent:1': 0.35; 'subject:from': 0.38; 'but': 0.38; 'appreciated': 0.38; 'subject:: ': 0.38; 'received:192': 0.38; 'should': 0.39; 'finding': 0.39; 'help': 0.40; 'full': 0.63; 'golden': 0.67; 'subject:name': 0.67; 'yourself:': 0.84 X-IronPort-AV: E=Sophos;i="4.65,261,1304287200"; d="scan'208";a="1866383" X-Virus-Scanned: amavisd-new at zimbra.sequans.com Date: Tue, 24 May 2011 18:13:20 +0200 From: Jean-Michel Pichavant User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) MIME-Version: 1.0 To: RVince Subject: Re: Obtaining a full path name from file References: <6af58349-43d3-4132-ab0a-a072852e6f3a@g12g2000yqd.googlegroups.com> <09bb028b-7050-4b8e-99b0-722af11918f7@y19g2000yqk.googlegroups.com> In-Reply-To: <09bb028b-7050-4b8e-99b0-722af11918f7@y19g2000yqk.googlegroups.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org 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: 27 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306253603 news.xs4all.nl 49178 [::ffff:82.94.164.166]:56188 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6151 RVince wrote: > Ha! You;re right -- but is there a way to get it without the filename > appended at the end? > > On May 24, 11:52 am, Tim Golden wrote: > >> On 24/05/2011 16:36, RVince wrote: >> >> >>> s = "C:\AciiCsv\Gravity_Test_data\A.csv" >>> f = open(s,"r") >>> >>> How do I obtain the full pathname given the File, f? (which should >>> equal "C:\AciiCsv\Gravity_Test_data"). I've tried all sorts of stuff >>> and am just not finding it. Any help greatly appreciated ! >>> >> You're going to kick yourself: >> >> f.name >> >> TJG >> > > path, fileName = os.path.split(os.path.abspath(f.name)) JM