title: Optparse Option Actions
body: <p>I'm working with optparse, and I'm writing a script with 3 commandline arguments. The first one (-qtype) specifies whether information needs to be called from a local file, or from the web. Then depending on this, the 2nd argument (-qname) is either a string of nucleotides, or a FASTA filename. The 3rd argument (-output) is the output filename.</p>
  <p>My question is if there is an optparse option action that I can use for the 1st argument (since the standard &quot;store,&quot; &quot;append,&quot; etc do not apply in this case).</p>
  <p>Here is what I have so far: (it is likely laced with errors)</p>
  <pre><code>import optparse
  
  if False:#__name__== '__main__':
      # parser object for managing input options
      parser = optparse.OptionParser()
  
      parser.add_option( '-qtype' ,  action = ‘?’ )
      parser.add_option( '-qname' , action = ‘?’ , […] )
      parser.add_option( '-output' , action = ‘store’ , type = ‘?’ , dest = ‘filename’ )
  
      # load the inputs
      args = [‘-qtype’ , ‘-qname’ , ‘-output’]
      (options , args) = parser.parse_args()
  </code></pre>
  <p>I have question marks and [...] where I am boggled over how to approach this problem.</p>