我收到错误:
TypeError: not all arguments converted during string formatting
尝试将此字符串hummer
传递给传递到%s
模块的变量subprocess
,如下所示:
import subprocess
mydim="hummer"
mycat=int(subprocess.check_output('cat dump_cars_tbl.out | grep -i %s | wc -l', shell=True) % mydim)
if mycat > 0:
print ('Yes')
else:
print ('No')
如何将此字符串正确传递给变量?