what's the command for (cd ..) in python

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Sep 9 09:03:10 EDT 2011


kaustubh joshi wrote:

> Hello friends,
>                          How do we carry out the command "*cd ..*" in
> python?

import os
os.chdir('..')

But think carefully before doing this. Some functions may be confused if you
change directories while they are running. You may be better off staying in
the same directory, and adjusting the path names to the files as you work
with them.



-- 
Steven




More information about the Python-list mailing list