
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to set the current working directory in Python?
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')
- Related Articles
- How to know current working directory in Python?
- How to display the current working directory in the Linux system?
- Get the Current Working Directory in Java
- Java Program to Get Current Working Directory
- Golang program to get current working directory
- Find out the current working directory in C/C++
- How to change current directory using Python?
- Find the Current Working Directory of a Running Process in Linux
- How to know/change current directory in Python shell?
- How to change the root directory of the current process in Python?
- How to find current directory of program execution in Python?
- How to change the shell working directory in Linux?
- How to get full path of current file's directory in Python?
- How to print full path of current file's directory in Python?
- How to get the current username and directory in Golang?

Advertisements