Python add constant values to argparse parameter
<p>I have googled this around but can't seem to find if this question has been asked already. I want to have a value (say "blah") to be always present for a list option, plus additional arguments if they are provided.</p>

<p>e.g.</p>

<pre><code>import argparse
args = argparse.ArgumentParser()
args.add_argument("--foo", nargs="+")

args = args.parse_args(["--foo", "bar1", "bar2", "bar3"])
args.foo.append("blah")


print args.foo
['bar1', 'bar2', 'bar3', 'blah']
</code></pre>

<p><code>argparse</code> has no facility to <em>add</em> a fixed set of values to <code>nargs</code> lists. </p>

<p>Just do what you already do and explicitly append to the list produced. </p>

python argparse