title: Python command line arg with getopt does not work
body: <p>I modified the sample code given here:
  <a href="http://www.tutorialspoint.com/python/python_command_line_arguments.htm" rel="nofollow">sample code for getopt</a></p>
  
  <p>as follows, but it does not work. I am not sure what I am missing. I added a "-j" option to this existing code. Eventually, I want to add as many as required command option to meet my needs. </p>
  
  <p>When I give input as below, it does not print anything.</p>
  
  <pre><code>./pyopts.py -i dfdf -j qwqwqw -o ddfdf
  Input file is " 
  J file is " 
  Output file is " 
  </code></pre>
  
  <p>Can you please let me know whats wrong here? </p>
  
  <pre><code>#!/usr/bin/python
  
  import sys, getopt
  
  def usage():
      print 'test.py -i &lt;inputfile&gt; -j &lt;jfile&gt; -o &lt;outputfile&gt;'
  
  def main(argv):
     inputfile = ''
     jfile = ''
     outputfile = ''
     try:
        opts, args = getopt.getopt(argv,"hij:o:",["ifile=","jfile=","ofile="])
     except getopt.GetoptError:
        usage()
        sys.exit(2)
     for opt, arg in opts:
        if opt == '-h':
           usage()
           sys.exit()
        elif opt in ("-i", "--ifile"):
           inputfile = arg 
        elif opt in ("-j", "--jfile"):
           jfile = arg 
        elif opt in ("-o", "--ofile"):
           outputfile = arg 
  
     print 'Input file is "', inputfile
     print 'J file is "', jfile
     print 'Output file is "', outputfile
  
  if __name__ == "__main__":
     main(sys.argv[1:])
  </code></pre>