0
我想要gunzip
一系列文件,然后将输出重定向到我的python脚本。 python脚本获取一个参数作为输入。我写了下面的命令:将gunzip输出重定向到python脚本
for i in $(ls test5/*/*gz); do gunzip -c $i | python script.py ; done
但它给我下面的错误:
Traceback (most recent call last):
File "./fqtofa.py", line 7, in <module>
inFile = sys.argv[1]
IndexError: list index out of range
我不知道为什么它不能从gunzip
输出读取。
您正在阅读stdin的输入,结帐http://stackoverflow.com/questions/1450393/how-do-you-read-from-stdin-in-python – zyxue