title: How can I execute python script with command line flag
body: <p>I have this bit of code:</p>
  
  <pre><code>of = open("oldfile")
  nf = open("newfile",'w')
  for line in of:
       if len(line) &gt; 17:
               nf.write(line)
  
  of.close()
  nf.close()
  </code></pre>
  
  <p>and instead of specifying 17, I want to be able to use a variable put it in my scripts directory and execute it directly. If there is no flag, it could print something like 'scriptname'. If there is a flag, as there is below, it would execute the code.</p>
  
  <blockquote>
    <p>$ myscriptname -l 17 oldfile newfile</p>
  </blockquote>