Home  >  Magazine  >  #73 May 2000  >  Python Programming for Beginners  >  Listing 12. Reading the Entire File at Once
Wednesday, March 29, 2000 | Last Updated 03:43:07 PM


  

Listing 12. Reading the Entire File at Once

#! /usr/local/bin/python
import sys
import re
data = sys.stdin.readlines()
if data != '':
    # do some processing of the contents of the
    # data variable
    data = re.sub('A-Z]', '=', str(data))
    # end of data processing module
    sys.stdout.write(data)
else:
    sys.stdout.flush()