擅长:python、mysql、java
<p>是的,您可以通过向参数中添加默认值来完成此操作:</p>
<pre><code>parser.add_argument(" RandomLine1", default=None)
# same for RandomLine2
# ...
if args.RandomLine1 is not None:
# use args.RandomLine1 as a number
#...
else:
# RandomNumber1 is not given in the args
#...
</code></pre>