sys.stdout.write(processed_line)
import sys
for line in sys.stdin:
    processed_line = process_line(line)
sys.stdout.write(processed_line)
Python - a subprocess writing to stdin so that the main program can read it from the stdin