|  |  | Python Library Reference |  |  |

Previous: 6.8.3.1 Replacing /bin/sh shell Up: 6.8.3 Replacing Older Functions Next: 6.8.3.3 Replacing os.system()

### 6.8.3.2 Replacing shell pipe line

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

|  |  | Python Library Reference |  |  |

Previous: 6.8.3.1 Replacing /bin/sh shell Up: 6.8.3 Replacing Older Functions Next: 6.8.3.3 Replacing os.system()

Release 2.4.1, documentation updated on 30 March 2005.