我想对目录中的每个文件执行一个 shell 命令。我不断收到错误。
这是代码:
import os
from subprocess import call
for dirname, dirnames, filenames in os.walk('.'):
for filename in filenames:
jpg = os.path.join(dirname, filename)
call(["./curl_recognize.sh", jpg, jpg".txt", "-t txt"])
这是错误:
call(["./curl_recognize.sh", jpg, jpg".txt", "-t txt"])
^
SyntaxError: invalid syntax