title: Optional command line arguments
body: <p>Given code like this, how do I actually set a file in the run options?</p>
  
  <p>I am using Spyder and have put <code>-h -s -p -o</code> as arguments, but I'm not sure how to specify a named file for the <code>-o</code> option.</p>
  
  <pre><code>class CommandLine:
      def __init__(self):
          opts, args = getopt.getopt(sys.argv[1:],'hspw:o:')
          opts = dict(opts)
  
          if '-o' in opts:
              self.outfile = opts['-o']
          else:
              self.outfile = None
  </code></pre>