擅长:python、mysql、java
<p>因为默认情况下<a href="https://docs.python.org/2/library/argparse.html#argparse.ArgumentParser.add_argument" rel="nofollow">^{<cd1>}</a>用于接受参数的参数(请尝试<code> help</code>),但必须设置<a href="https://docs.python.org/2/library/argparse.html#action" rel="nofollow">^{<cd3>}</a>。在</p>
<pre><code>parser.add_argument(' same', help = 'Find those in List1 that are the same in List2', action='store_true')
</code></pre>
<p>这是您的<code> help</code>:</p>
^{pr2}$
<p>一旦参数被解析,就可以作为arg的成员访问它们:</p>
<pre><code>data1 = set(l.rstrip() for l in open(args.infile1))
data2 = set(l2.rstrip() for l2 in open(args.infile2))
</code></pre>