Python – Navigation directories

If you want to do pwd, cd, and ls, then you need to import the os module first:

import os

Now we have the following functions:

=>=>=> os.getcwd() # equivalent to pwd
=>=>=> os.chdir("C:/") # equivalent to cd
=>=>=> os.listdir() # equivalent to ls
['$AVG', '$Recycle.Bin', 'Documents and Settings', 'hiberfil.sys', 'inetpub', 'Intel', 'NV
IDIA', 'pagefile.sys', 'PerfLogs', 'Prey', 'Program Files', 'Program Files (x86)', 'Progra
mData', 'Python34', 'Recovery', 'System Volume Information', 'Temp', 'Users', 'Windows']