title: How to get result from grep with Python
body: <p>I am trying to get output from grep with wildcard</p>
  
  <pre><code>proc = subprocess.Popen(['grep', '002HQV', 'test.*'], stdout=subprocess.PIPE,  
  shell=True)
  res = proc.stdout.readlines()
  print(res)
  </code></pre>
  
  <p>but get the following error</p>
  
  <pre><code>2.4.3 (#1, Jun 11 2009, 14:09:37)
  [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
  Usage: grep [OPTION]... PATTERN [FILE]...  
  Try `grep --help' for more information.
  []
  </code></pre>
  
  <p>Is it wrong with my grep syntax?</p>
  
  <p>The following works</p>
  
  <pre><code>proc = subprocess.Popen(['ls', '*'], stdout = subprocess.PIPE, shell=True)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>os.system("grep 02HQV test.*")
  </code></pre>