Skip to content
jasper-zanjani edited this page Aug 6, 2020 · 1 revision

Execute shell command given by string. The value returned is actually the exit code, not the output of the command to STDOUT.

os.system('ls -la')

Store output in a variable

os.popen('ls -la').read()

Navigate filesystem

os.getcwd()
os.chdir(path)

Test for existence of a file

os.path.isfile(file)