In Python, how can I get the effect of cd - in the shell? That is, after changing the working directory, how can I set it back to what it was before that change?
In Python, how can I get the effect of cd – in the shell?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re looking to change the working directory? The OS module in python has a lot of functions to help with this.
pathbeing".."to go up one directory. If you need to check where you are before/after a change of directory you can issue thegetcwd()command: