title: Python argparse optional dash-integer argument
body: <p>Is it possible to add an optional argument with argparse as -&lt;integer&gt;,</p>
  <p>similar to unix <code>head</code> and <code>tail</code> commands which accept -&lt;integer&gt; to say how many lines to print,<br>
  or similar to <code>git log</code> which accepts -&lt;integer&gt; to say how many log entries to print?</p>
  <p>For example,</p>
  <pre><code>head -4     # print four lines
  tail -12    # print 12 lines.
  git log -7  # print 7 log entries
  </code></pre>
  <p>Whereas the argument <em>is</em> optional, for example these all work:</p>
  <pre><code>head        # print default number of lines
  tail        # print default number of lines
  git log     # print all log entries through system pager
  </code></pre>
  <h3>Is there a general and/or accepted way to do this in Python?</h3>
  <p>Thanks.</p>