The subprocess
module is the preferred way of running other programs from Python -- much more flexible and nicer to use than os.system
.
import subprocess
#subprocess.check_output(['ls', '-l']) # All that is technically needed...
print(subprocess.check_output(['ls', '-l']))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…