170k views
5 votes
How do I change directories in python to run a file?

How do I change directories in python to run a file?-example-1
User Mcool
by
4.4k points

1 Answer

1 vote

write the following at the top of your program:

import os

then write in your code:

os.chdir(path)

and where I've written path, write where you want to change to

User Rufel
by
5.2k points