How to move between directories in python 3 with the linux operating system?


I try to move directory in python 3 but it gives an error:

import os

os.system("cd /")

I tried this one but it does not work either:

import os

os.chdir("cd /")

In this case, I use the operating system parrot os 4.2.2.

Any solution? Thank you in advance for your answers !!

asked by Julio Cesar 13.11.2018 в 01:41

1 answer


With chdir it is not necessary to write cd within the string where you place the folder. You simply indicate to what directory you want to go.

Try this

import os

You can see the documentation for chdir here

answered by 26.11.2018 в 11:39