Re: Help in rotate 13 program

2011-12-29 Thread Sayantan Datta
On Thu, Dec 29, 2011 at 10:09 PM, Dave Angel wrote: > On 12/29/2011 11:25 AM, Sayantan Datta wrote: > >> On Thu, Dec 29, 2011 at 5:34 PM, Chris Angelico wrote: >> >> On Thu, Dec 29, 2011 at 10:48 PM, Sayantan Datta >>> wrote: >>> for line in sys.stdin : for char in line : >>

Re: Help in rotate 13 program

2011-12-29 Thread Dave Angel
On 12/29/2011 11:25 AM, Sayantan Datta wrote: On Thu, Dec 29, 2011 at 5:34 PM, Chris Angelico wrote: On Thu, Dec 29, 2011 at 10:48 PM, Sayantan Datta wrote: for line in sys.stdin : for char in line : sys.stdout.write(rotate13_letter(char)) cat sample.html | python rot13.py rot13.

Re: Help in rotate 13 program

2011-12-29 Thread Chris Angelico
On Fri, Dec 30, 2011 at 3:25 AM, Sayantan Datta wrote: > did that, but the output file is still empty? Does the fault lie somewhere > else? I'm not sure if it's a copy-paste problem, but check your indentation: your "if __name__" line seems to be indented, it should be flush left. Indentation mak

Re: Help in rotate 13 program

2011-12-29 Thread Sayantan Datta
On Thu, Dec 29, 2011 at 5:34 PM, Chris Angelico wrote: > On Thu, Dec 29, 2011 at 10:48 PM, Sayantan Datta > wrote: > > for line in sys.stdin : > > for char in line : > > sys.stdout.write(rotate13_letter(char)) > > > > cat sample.html | python rot13.py rot13.html > > You're reading from

Re: Help in rotate 13 program

2011-12-29 Thread Peter Otten
Sayantan Datta wrote: > 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? I don't know if that's a copy-n-paste error: the indentation of > if __name__ == '__main__' : > for line in sys.stdin : > for char

Re: Help in rotate 13 program

2011-12-29 Thread Chris Angelico
On Thu, Dec 29, 2011 at 10:48 PM, Sayantan Datta wrote: >     for line in sys.stdin : >       for char in line : > sys.stdout.write(rotate13_letter(char)) > > cat sample.html | python rot13.py rot13.html You're reading from stdin, which is correct, but you're writing to stdout and not redirecting

Re: Help in rotate 13 program

2011-12-29 Thread Robert Kern
On 12/29/11 11:48 AM, Sayantan Datta wrote: cat sample.html | python rot13.py rot13.html cat sample.html | python rot13.py > rot13.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as

Help in rotate 13 program

2011-12-29 Thread Sayantan Datta
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_