please help me, this code doesn't work, the output file comes out to be empty. How do i fix it? and where is it going wrong?
==============rot13.py============== #!/usr/bin/env python import sys import string CHAR_MAP=dict(zip(string.ascii_lowercase, string.ascii_lowercase[13:26] + string.ascii_lowercase[0:13])) def rotate13_letter(letter) : """ Return the 13-char rotation of a letter """ do_upper = False if letter.isupper() : do_upper = True letter = letter.lower() if letter not in CHAR_MAP : return letter else : letter = CHAR_MAP[letter] if do_upper : letter=letter.upper() return letter if __name__ == '__main__' : for line in sys.stdin : for char in line : sys.stdout.write(rotate13_letter(char)) ===========sample.html=========== <html> <head> <title> Hello, World! </title> </head> <body> <p> Hi there, all of you earthlings </p> <p> Take us to your leader. </p> </body> </html> ===============TERMINAL============ this is what i run in the terminal, cat sample.html | python rot13.py rot13.html
-- http://mail.python.org/mailman/listinfo/python-list