我使用python的subprocess.check_output()
,并使用它运行一个python文件,该文件具有某些属性(如文件名、标题等)。一切正常,但是,我决定传递一个字符串变量,而不是一个实际的字符串。我不知道为什么不行。有人看到我看不到的东西吗?在
import textFile
import upload
import subprocess
def upload(fileName):
arr = []
bunny = "big_buck_bunny.flv" #this is the variable
arr = textFile.readLine(fileName)
size = textFile.getLines(fileName)
i = 0
while(i < size):
f = open("upload.py-oauth2.json", 'w').close()
textFile.append("C:\\Users\\user1\\Desktop\\tester\\upload.py-oauth2.json",arr[i])
#This below is where i would like to pass in a variable
subprocess.check_output('python upload.py --file="C:\\Users\\...\\anniebot\\' + bunny)
i+=1
upload("C:\\Users\\user1\\Desktop\\tester\\accountList.txt")
所以我很想不断改变这条路。问题是,如果不传入固定字符串,我就无法找到让子进程工作的方法。在
我想做点什么比如:在
^{pr2}$
你的意思是:
因此,基本上是使用单引号连接字符串,而不是使用双引号。在
相关问题 更多 >
编程相关推荐