#!/usr/bin/env python3 import os,sys # these are your friends for interfacing the OS print('os.system(\'pwd\')') os.system('pwd') # runs any unix command print() print('x=os.popen(\'pwd\').read()') x=os.popen('pwd').read() # to get output from shell, use popen and read() print(x) print('os.system(\'cd ../data\')') os.system('cd ../data') # you can't direct the shell from inside python directly print('os.system(\'pwd\')') os.system('pwd') print() print('os.chdir(\'../data\')') os.chdir('../data') # os module controls directories and files print('os.system(\'pwd\')') os.system('pwd') print() print('x=os.popen(\'ls\').read().split(\'\\n\')') x=os.popen('ls').read().split('\n') # to get output from shell, use popen and read() print(x) print() print('sys.argv',sys.argv)