Home  >  Magazine  >  #73 May 2000  >  Python Programming for Beginners  >  Listing 10. Modifying Standard Input
Wednesday, March 29, 2000 | Last Updated 03:43:01 PM


  

Listing 10. Modifying Standard Input

#! /usr/local/bin/python
import sys
while 1:
    data = sys.stdin.readline()
    if data != '':
        # do some processing of the contents of
        # the data variable
        data = '#'+data
        # end of data processing module
        sys.stdout.write(data)
    else:
        sys.stdout.flush()
        break