title: Python: invalid literal for int() with base 10: 'a'
body: <pre><code>import sys
  
  a =int( sys.argv[1])
  
  print "\nArguments --&gt;",a , sys.argv[2]
  
  print "\nNo of Argu ",  len(sys.argv), "\n"
  
  print str(sys.argv)
  </code></pre>
  
  <p>command window output which i give is:</p>
  
  <pre><code>python testfunction.py a sf df sf
  </code></pre>
  
  <p>Whenevr the first argument is taken as 'a', it shows the error --> </p>
  
  <pre><code>invalid literal for int() with base 10: 'a'
  </code></pre>
  
  <p>Newbie to python.
  PLease provide the solution for how to handle this without try except</p>
  
  <p>Also </p>
  
  <p>When i dont give ant argument i should handle that too</p>
  
  <p>Command window outout which i give: </p>
  
  <p>python testfunction.py </p>
  
  <p>Error: IndexError: list index out of range</p>