Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change the current working directory in python

import os
cdir = os.getcwd() # it will return current working directory
print("Previous_dir",cdir)
# Previous_dir C:Users..Desktoppython
os.chdir('C:/Users/../Desktop/desire_folder') #chdir used for change direcotry
print("Current_dir",cdir)
# Current_dir C:Users..Desktoppython	eamspirit
Comment

change working directory python

import os
os.chdir(new_working_directory)
Comment

Change my python working directory

# Import the os module
import os

# Print the current working directory
print("Current working directory: {0}".format(os.getcwd()))

# Change the current working directory
os.chdir('/tmp')

# Print the current working directory
print("Current working directory: {0}".format(os.getcwd()))
Comment

Python Changing Directory

>>> os.chdir('C:Python33')

>>> print(os.getcwd())
C:Python33
Comment

PREVIOUS NEXT
Code Example
Python :: flask api abort 
Python :: number of words in a string python 
Python :: matplotlib location legend 
Python :: how to extract integers from string python 
Python :: from math import python 
Python :: rename columns 
Python :: how explode by using two columns pandas 
Python :: how to install neat 
Python :: time py 
Python :: remove extra spaces and empty lines from string python 
Python :: matplotlib measure the width of text 
Python :: pyhon random number 
Python :: ban command in discord.py 
Python :: python dict key delete 
Python :: change text in legend matplotlib 
Python :: remove hyperlink from text python 
Python :: How to install pandas-profiling 
Python :: find sum of 2 numbers in array using python 
Python :: pythonwrite to file 
Python :: fetch email from gmail using python site:stackoverflow.com 
Python :: pattern in python 
Python :: detect operating system using python 
Python :: how to make an ai 
Python :: python infinity 
Python :: dataframe to dict without index 
Python :: date strftime python 
Python :: install tensorflow gpu 
Python :: pandas apply function to each row lambda 
Python :: list all files starting with python 
Python :: python sort class by attribute 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =