Running cmd in python

后端 未结 4 1940
南方客
南方客 2020-12-28 22:12

Atm I have this as my code, the first line seems to work well but the 2nd gives errrors.

os.chdir(\'C://Users/Alex/Dropbox/code stuff/test\')
subprocess.call(         


        
4条回答
  •  别那么骄傲
    2020-12-28 22:39

    What version of Python are you using? getstatusoutput() is deprecated since version 2.6. In Python 3 you can use subprocess for the same effect.

    subprocess.getoutput('cd /Users/Alex/code/pics/')
    

提交回复
热议问题