LJ Archive

Listing 14. Reading from Pipe

#! /usr/local/bin/python
import os
try:
    po = os.popen('cat /usr/doc/FAQ/txt/Linux-FAQ | pr -2', 'r')
except IOError:
    exit(0)
print po.read()
LJ Archive