title: Can't get command line argument using sys.argv in python
body: <p>I try to pass command line argument to python script under win7, but the length of sys.argv always equals to one. Is that means it fails to recognize the argument? 
  Here is the code and command line:</p>
  
  <pre><code>import sys
  def Cat(filename):
      f = open(filename, 'r')
      for line in f:
          print(line)
  
  def main():
      if len(sys.argv) &gt; 1:
          Cat(sys.argv[1])
      else:
          print(input('enter argument: '))
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Here is my command line:</p>
  
  <pre><code>F:\Google's_python_class\part1&gt;Cat.py small.txt
  </code></pre>
  
  <p>But the result is </p>
  
  <pre><code>enter argument:
  </code></pre>
  
  <p><strong>SOLVED:</strong></p>
  
  <p>There are two solutions:</p>
  
  <ol>
  <li><p><code>c:\...\python\python.exe Cat.py small.txt</code></p></li>
  <li><p><a href="https://stackoverflow.com/questions/29540541/executable-python-script-not-take-sys-argv-in-windows">solution two</a></p></li>
  </ol>