Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #13020
| Date | 2011-09-09 14:07 +0200 |
|---|---|
| Subject | what's the command for (cd ..) in python |
| From | kaustubh joshi <kandrjoshi@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.903.1315570033.27778.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
what's the command for (cd ..) in python kaustubh joshi <kandrjoshi@gmail.com> - 2011-09-09 14:07 +0200
Re: what's the command for (cd ..) in python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-09 23:03 +1000
Re: what's the command for (cd ..) in python Terry Reedy <tjreedy@udel.edu> - 2011-09-09 13:35 -0400
Re: what's the command for (cd ..) in python "Waldek M." <wm@localhost.localdomain> - 2011-09-10 12:32 +0200
Re: what's the command for (cd ..) in python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-10 21:11 +1000
Re: what's the command for (cd ..) in python "Waldek M." <wm@localhost.localdomain> - 2011-09-10 15:57 +0200
Re: what's the command for (cd ..) in python Cameron Simpson <cs@zip.com.au> - 2011-09-11 09:50 +1000
csiph-web