title: optparse python methods options commandline
body: <p>I want to call python script with options like following:</p>
  
  <pre><code>$python script.py --i fname.txt --j c --k True
  </code></pre>
  
  <p>I have written a python script to open a file if condition true; now I want to make it commandline, I want to use "optparse" module for that and I have written the follwoing script so far, btu I can't not get the desire results, python executing the scritp without any error though. Any ideas how ti fix it ?? Thanks !  </p>
  
  <pre><code>import optparse    
  
  def ab(i, j, k=None): 
      if (j == c):
          e = 'fname.txt'
          with open(e, 'rU') as use:
               for u in use:
                    u = use.plit()
                    with open(i, 'rU') as use2:
                         for u2 in use2:
                              u2 = u2.plit()
                              if k:
                                   if u[0] in u2:
                                        print(u2)
  
  
  def main():
       parser = pstparse.OptaionParser('usage %prog --i &lt;input file&gt; --k &lt;&gt; --j &lt;&gt;')
       parser.add_option('--i', dest = 'filename')
       parser.add_option('--j', type = 'string')
       parser.add_option('--k', type = 'string')
  
      (options, args) = parser.parse_args()
       if (options.i == '--i'):
            args == i
       if (options.j == '--j'):
            args == j
       if (options.k == '--k'):
            args == k
  
       if __name__ =="__main__":
           main()
  </code></pre>