title: Does Python have an argc argument?
body: <p>I have written the same program (open text file and display contents) in C and C++. Now am doing the same in Python (on a Linux machine).</p>
  
  <p>In the C programs I used the code:</p>
  
  <pre><code>if (argc != 2) {
      /* exit program */
  }
  </code></pre>
  
  <p><strong>Question: What is used in Python to check the number of arguments</strong></p>
  
  <pre><code>#!/usr/bin/python
  import sys
  try:
      in_file = open(sys.argv[1], "r")
  except:
      sys.exit("ERROR. Did you make a mistake in the spelling")
  text = in_file.read()
  print text
  in_file.close()
  </code></pre>
  
  <p>Current output:</p>
  
  <pre><code>./python names.txt = Displays text file (correct)
  ./python nam = error message: stated from the sys.ext line (correct)
  ./python = error message: stated from the sys.ext line (wrong: want it to be a
  separate error message stating *no file name input*)
  </code></pre>