6.8.3.2 Replacing shell pipe line

Python PEP

6.8.3.2 Replacing shell pipe line

output=`dmesg | grep hda`
==>
p1 = Popen(["dmesg"], stdout=PIPE)
p2 = Popen(["grep", "hda"], stdin=p1.stdout)
output = p2.communicate()[0]

See About this document... for information on suggesting changes.