How do subprocess.Popen("ls | grep foo", shell=True) with shell=False?

Dan Stromberg drsalists at gmail.com
Thu Jun 10 18:38:42 EDT 2010


On Thu, Jun 10, 2010 at 4:52 AM, Nobody <nobody at nowhere.com> wrote:
>
> Also, "ls | grep" may provide a useful tutorial for the subprocess module,
> but if you actually need to enumerate files, use e.g. os.listdir/os.walk()
> and re.search/fnmatch, or glob. Spawning child processes to perform tasks
> which can easily be performed in Python is inefficient (and often creates
> unnecessary portability issues).


I agree with you about the portability issue.

However, *ix shell is turning out pretty prescient in the area of
performance - there are few languages that parallelize as well if you code
to minimize exec's, or that stay as simple when parallelizing - and with
multicore processors taking off...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100610/91b2df51/attachment-0001.html>


More information about the Python-list mailing list