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

0

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
source

1 answer

0

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
os.chdir("/home")
os.getcwd()

You can see the documentation for chdir here

    
answered by 26.11.2018 в 11:39