Home  >  Magazine  >  #73 May 2000  >  Python Programming for Beginners  >  Listing 11. Reading from Standard Input
Wednesday, March 29, 2000 | Last Updated 03:43:04 PM


  

Listing 11. Reading from Standard Input

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