我想要gunzip一系列文件,然后将输出重定向到我的python脚本。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输出中读取。
发布于 2015-08-31 17:31:46
sys.argv用于命令行参数.你不能通过这些,你是通过stdin把它输送进来的。因此,您需要从sys.stdin中阅读。
https://stackoverflow.com/questions/32316658
复制相似问题