title: What does "sys.argv[1]" mean?
body: <p>I'm currently teaching myself Python and was just wondering (In reference to my example below) in simplified terms what the <code>sys.argv[1]</code> represents. Is it simply asking for an input?</p>
  <pre><code>
  #!/usr/bin/python3.1
  
  # import modules used here -- sys is a very standard one
  import sys
  
  # Gather our code in a main() function
  def main():
    print ('Hello there', sys.argv[1])
    # Command line args are in sys.argv[1], sys.argv[2] ..
    # sys.argv[0] is the script name itself and can be ignored
  
  # Standard boilerplate to call the main() function to begin
  # the program.
  if __name__ == '__main__':
    main()
  </code></pre>
  <hr />
  <p><sub>You may have been directed here because you were asking about an <code>IndexError</code> in your code that uses <code>sys.argv</code>. The problem is <strong>not in your code</strong>; the problem is that you need to <strong>run</strong> the program in a way that makes <code>sys.argv</code> contain the right values. Please read the answers to understand how <code>sys.argv</code> works.</sub></p>
  <p><sub>If you have read and understood the answers, and are still having problems <strong>on Windows</strong>, check if <a href="https://stackoverflow.com/questions/29540541/python-script-does-not-take-sys-argv-in-windows">Python Script does not take sys.argv in Windows</a> fixes the issue. If you are trying to run the program <strong>from inside an IDE</strong>, you may need IDE-specific help - please search, but first check if you can run the program successfully from the command line.</sub></p>