Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.102 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.80; '*S*': 0.00; 'python?': 0.05; 'does.': 0.07; 'script,': 0.07; 'subject:python': 0.11; '.."': 0.16; '8bit%:82': 0.16; 'skip:- 130': 0.16; 'subject:command': 0.16; 'trying': 0.21; 'skip:\xa0 40': 0.23; 'command': 0.24; 'variable': 0.24; 'problem': 0.28; 'message-id:@mail.gmail.com': 0.29; '\xa0\xa0\xa0': 0.31; 'values': 0.32; 'skip:\xa0 30': 0.32; 'it.': 0.33; 'there': 0.33; 'to:addr:python-list': 0.33; 'file.': 0.34; 'stuck': 0.34; 'folder': 0.35; 'file': 0.36; 'created': 0.36; 'using': 0.37; 'run': 0.37; 'but': 0.37; 'something': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'help': 0.39; 'missing': 0.39; 'to:addr:python.org': 0.39; 'subject: (': 0.39; 'carry': 0.62; 'skip:1 10': 0.63; 'designed': 0.65; 'taking': 0.66; '8bit%:93': 0.67; '8bit%:94': 0.69; '8bit%:100': 0.70; '--->': 0.84; 'the\xa0': 0.84; 'received:209.85.218.46': 0.91; 'received:mail-yi0-f46.google.com': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=gcik5Vr3xZdALdeXxHAJ4mDbb9NmVNU1yirJ9qeQSHM=; b=Y0BjYRAn6cXAfOtM4jiOUIveJiSqCBqnIPdATHEvidvywpBy3XIFx8hgDOjMwgvu2i T0c7Ydosyno4bHWndTpZ5TO9wwyZKSc9mniy8kqrSGeklxY6HPXOhVwB9Adq3mLopMu5 u/baMOtgvBT2DI5Mi8SzxiawdRpD/syxYfw+o= MIME-Version: 1.0 Date: Fri, 9 Sep 2011 14:07:03 +0200 Subject: what's the command for (cd ..) in python From: kaustubh joshi To: python-list@python.org Content-Type: multipart/alternative; boundary=bcaec52155aff4ec4704ac810361 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: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1315570033 news.xs4all.nl 2470 [2001:888:2000:d::a6]:44130 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!feed.ac-versailles.fr!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:13020 --bcaec52155aff4ec4704ac810361 Content-Type: text/plain; charset=ISO-8859-1 Hello friends, How do we carry out the command "*cd ..*" in python? My problem is : I have a set of folders say m=1,2,3,4. In each of these folders, I have subfolders with common name say m_5,m_6,m_7,m_8. In each of these subfolder, there is a file which I have edit. 1 2 3 4 | | | | ------------------------------------------------------------------------------------------------------------------------------------------ 1_5, 1_6, 1_7, 1_8 2_5 ,2_6, 2_7, 2_8 3_5, 3_6, 3_7, 3_8 4_5, 4_6, 4_7, 4_8 That is how I designed it When I run my script, it follows the route 1 ---> 1_5-----> do the edit job in the file. Now it need to change the subfolder from 1_5 to 1_6, which is not happening. I created the folders using variable like m for folder taking values 1,2,3,4 and m_n for subfolders with n=5,6,7,8. I am trying with os.chdir(path), but stuck with how to use m_n in it. What I am missing at the moment is something that do the job "cd .." does. Any help Karan --bcaec52155aff4ec4704ac810361 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: base64 SGVsbG8gZnJpZW5kcyw8YnI+oKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgIEhvdyBkbyB3ZSBjYXJy eSBvdXQgdGhlIGNvbW1hbmQgJnF1b3Q7PGI+Y2QgLi48L2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