我想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
输出。你知道吗
sys.argv
用于命令行参数。你不能通过这些,你要通过标准输入。所以你需要阅读sys.stdin
。你知道吗相关问题 更多 >
编程相关推荐