

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to know/change current directory in Python shell?
You can change directory or cd in Python using the os module. It takes as input the relative/absolute path of the directory you want to switch to.
For example
>>> import os >>> os.chdir('my_folder')
To know the current working directory or pwd use the os module.
For example
>>> import os >>> print(os.getcwd()) /home/ayush/qna
- Related Questions & Answers
- How to know current working directory in Python?
- How to change current directory using Python?
- How to change the shell working directory in Linux?
- How to change the root directory of the current process in Python?
- How to set the current working directory in Python?
- How to know the current position within a file in Python?
- How to find current directory of program execution in Python?
- How to change the permission of a directory using Python?
- How to change the owner of a directory using Python?
- How to clear Python shell?
- How to print full path of current file's directory in Python?
- How to get full path of current file's directory in Python?
- How to print current package cache directory information in android?
- How to get the current username and directory in Golang?
- Java Program to Get Current Working Directory
Advertisements