Reading from stdin

C GIllespie csgcsg39 at hotmail.com
Wed Mar 10 09:56:40 EST 2004


Dear All,

I have a C program that prints out numbers 1 to 10 to stdout. I wish to pipe
this into a python script to print out the numbers, e.g. ./myCProg |
myPython.py

However, I want the python script to print out the numbers as it gets them,
since there could be hours/days between numbers - not a very efficient C
program :). Actually, I would like to read-a-line/ print-a-line/
read-a-line/etc

I have tried things like 'sys.stdin.read*' with no success.

Thanks

Colin





More information about the Python-list mailing list