Fredrik Lundh  wrote:

>         import os
>         for line in os.popen("grep pattern *.txt"):
>             print line,
>
> also see os.system and subprocess.
>
> note that if you want to write portable code, you can implement your own
> "grep" using the "re" module:

> </F>

Also, for a wrapper around popen, try commands:

  import commands

  pattern = raw_input('pattern to search? ')
  print commands.getoutput('grep %s *.txt' % pattern)

Pete

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to