Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18167 > unrolled thread

Re: Help in rotate 13 program

Started byChris Angelico <rosuav@gmail.com>
First post2011-12-29 23:04 +1100
Last post2011-12-29 23:04 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Help in rotate 13 program Chris Angelico <rosuav@gmail.com> - 2011-12-29 23:04 +1100

#18167 — Re: Help in rotate 13 program

FromChris Angelico <rosuav@gmail.com>
Date2011-12-29 23:04 +1100
SubjectRe: Help in rotate 13 program
Message-ID<mailman.4215.1325160274.27778.python-list@python.org>
On Thu, Dec 29, 2011 at 10:48 PM, Sayantan Datta <kenzo.zombie@gmail.com> 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 it. You need to put an arrow before
rot13.html to indicate redirection:

cat sample.html | python rot13.py >rot13.html

Note though that 'cat' is superfluous here; all you need to do is
redirect input:
python rot13.py <sample.html >rot13.html

Hope that helps!

Chris Angelico

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web