#!/usr/bin/python import sys, re for line in sys.stdin: print re.sub("[A-Z]","#", line), ###################################### Explanation = """ This program demonstrates the re (regular expression) module. It reads lines from the 'standard input' (your terminal) It converts all uppercase characters on the input into hash marks (#). more about regular expressions: http://www.aims.ac.za/resources/tutorials/regexp/ Note the comma at the end of the line. It prevents python from printing the usual newline at the end of line. These lines already contain a newline. """