Python 为多个参数接受多个值会导致意外结果

Python 为多个参数接受多个值会导致意外结果,python,docopt,Python,Docopt,我有以下文件: """gene_sense_distribution_to_csv Usage: gene_sense_distribution_to_csv.py <gene> <csv_out> <filenames>... [--min_count=<kn>] [--gene_regions=<kn>] gene_sense_distribution_to_csv.py -h | --

我有以下文件:

"""gene_sense_distribution_to_csv
Usage:
    gene_sense_distribution_to_csv.py <gene> <csv_out> <filenames>... [--min_count=<kn>] [--gene_regions=<kn>]
    gene_sense_distribution_to_csv.py -h | --help
    gene_sense_distribution_to_csv.py params
    gene_sense_distribution_to_csv.py example

Options:
    -h --help            Shows this screen.
    --min_count=<kn>     Minimal number of reads in a pileup line in order to consider it in the analysis [default: 0]
    --gene_regions=<kn>  All the gene regions you want to plot. Options: 5utr, 3utr, exon. The default is all of them. Separate them by space [default: ['5utr', '3utr', 'exon']]
"""
可以看出,
参数得到了
内含子,而我的意思是
--gene_regions
会得到它。
有没有办法解决这个问题

编辑:我遇到了一个解决方法,只需执行
python脚本\u NAME GENE OUTPUT\u PATH INPUT\u PATH--GENE\u regions的exon,intron'
并对其进行解析


仍希望您能给出一个不是解决办法的答案。

您需要重复该选项和值,例如:

... --gene_regions exon --gene_region intron
下面是一个完整的示例(使用“gene_区域”,单数):

“基因”感测分布到csv
用法:
gene_sense_distribution_to_csv.py…[--min_count=][--gene_region=…]
gene_sense_distribution_to_csv.py-h |--帮助
gene_sense_distribution_to_csv.py参数
gene_sense_distribution_to_csv.py示例
选项:
-h—帮助显示此屏幕。
MILCOUNTATION =在分析中考虑最小的读取数,以便在分析中考虑它[缺省值:0 ]
--gene_region=要绘制的所有基因区域。选项:5utr、3utr、exon。默认值为所有。指定多次。。。
"""
$。/gene_sense_distribution_to_csv.py gene1 csvout file2--min_count=mm--gene_region=r2--gene_region=r3--gene_region r4
{'--基因_区:['r2','r3','r4'],
“帮助”:错误,
“--min_count”:“mm”,
“‘csvout’,
'':['file1','file2'],
“‘基因1’,
“示例”:错误,
“params”:False}

OT:将选项放在参数之前是个好主意,在某些情况下会给您更多的自由(请参阅
--
特殊参数),参考

gene_sense_distribution_to_csv.py[--min_count=][--gene_region=…].

... --gene_regions exon --gene_region intron