问题是在调用命令中获取调用以识别o.geturl()命令。
from subprocess import call
import time
from urlparse import urlparse
def ListOfTests():
myFile = open("testUrlToImport.txt", "r")
myLines = list(myFile)
myFile.close()
for urls in myLines:
urlsAsAString = str(urls)
o =urlparse(urlsAsAString)
call(["phantomjs", "yslow.js", "--info", "basic", "--format", "plain", "o.geturl()"])
任何指示都值得赞赏。谢谢!
您应该从o.geturl()
中删除引号。这应该有效:
call(["phantomjs", "yslow.js", "--info", "basic", "--format", "plain", o.geturl()])