现在我能够将整个列表从批处理文件传递给python,但我希望在每个循环中传递每个元素。我怎样才能做到这一点?
sub.py
import subprocess
import random
item = subprocess.Popen(["test.bat", str(random.randrange(0,20))] ,
shell=True, stdout=subprocess.PIPE)
for line in item.stdout:
print line
test.bat的
set list=hai hello trial
(for %%a in (%list%) do (
echo %%a
))