mmyyrrmm
candy_rong
2017-08-07 10:45

python在拼接字符串时,通过参数连接时就执行报错,写死执行的文件就不报错,为什么会这样?

  • python
        for item in testfiles:
           #subprocess.call("python ..\\TestCases\\" + str(item).replace("\\n", ""), shell=True)
           print "修改前:" + os.getcwd()
           os.chdir('/Users/yirong/PycharmProjects/CloudResWebTest/TestCases')
           print "修改后:" + os.getcwd()
                         #这样子报错,我将command打印出来也是python TC_Search_Python.py
           command="python "+str(item) 
                         #这样子执行正常
           #command="python TC_Search_Python.py"
           print command
           subprocess.call(command,shell=True)
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐