【发布时间】:2012-04-11 18:35:41
【问题描述】:
假设我希望rsgen.py 的输出用作我的simulate.py 脚本的references 参数。我该怎么做?
在simulate.py
parser.add_argument("references", metavar="RS", type=int, nargs="+", help="Reference string to use")
我试过了
# ./simulate.py references < rs.txt
usage: simulate.py [-h] [--numFrames F] [--numPages P] RS [RS ...]
simulate.py: error: argument RS: invalid int value: 'references'
# ./simulate.py < rs.txt
usage: simulate.py [-h] [--numFrames F] [--numPages P] RS [RS ...]
simulate.py: error: too few arguments
我认为我的管道语法有误,我该如何解决?
理想情况下,我想直接将rsgen.py 的输出通过管道传输到simulate.py 的references 参数中
【问题讨论】:
标签: python unix pipe command-line-arguments argparse