|  |  | Python Library Reference |  |  |

Previous: 17.1.3.1 Replacing /bin/sh shell Up: 17.1.3 Replacing Older Functions Next: 17.1.3.3 Replacing os.system()

### 17.1.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: 17.1.3.1 Replacing /bin/sh shell Up: 17.1.3 Replacing Older Functions Next: 17.1.3.3 Replacing os.system()

Release 2.5.2, documentation updated on 21st February, 2008.