title: Python argparse: both optional and positional value for an argument
body: <p>Consider the following usage:</p>
  
  <pre><code>usage: do.py [-h] [-s | -m] filename
  </code></pre>
  
  <p>This is not the complete usage. But I effectively want is <code>filename</code> to be an actual value of file and not:</p>
  
  <pre><code>--filename FILENAME
  </code></pre>
  
  <p>But also, <code>filename</code> should be optional so I can read from the standard input. Think about the <code>cat</code> program on UNIX.</p>
  
  <p>You simply say:</p>
  
  <pre><code>cat filename
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>cat
  </code></pre>
  
  <p>EDIT: Right now, if I execute the program <code>do.py</code> without any command line options, I will get an <code>error: too few arguments</code>. Instead I would still want it to execute even if I don't give it a valid <code>filename</code>. How do I do that?</p>