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


Groups > comp.lang.python > #18167

Re: Help in rotate 13 program

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'char': 0.07; 'python': 0.08; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps!': 0.16; 'stdin,': 0.16; 'stdout': 0.16; 'superfluous': 0.16; 'subject:Help': 0.17; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'correct,': 0.23; 'message-id:@mail.gmail.com': 0.28; 'pm,': 0.29; 'chris': 0.30; 'thu,': 0.32; 'to:addr:python-list': 0.34; 'it.': 0.34; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'put': 0.38; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'hope': 0.61; '2011': 0.61; 'subject:program': 0.67; '29,': 0.73; 'redirecting': 0.84; 'redirect': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=RHaqP0A3C9E2yh2BVDyGLODNr64sbspq39GCaghwBTk=; b=M7Ptdbih1vHL5NcPukvR2ttyUVVuxEAwg5ux6dvGu+QD4k+4KvP6iSyjSru6Ags0se CvEkIofqNb1mLM0qrilJ8PCxxHaJqAb34Vhk0l8AJeRl+yPCq6PtN0r4uwR1wLBOoI0p NWl/2gG5ZTAzeJ7/eAyjXnVOas2rKwum87kp4=
MIME-Version 1.0
In-Reply-To <CANtuMdJMfLg4VXhuSowG-Tr1yzioACLWQqJHhgi49w4sJYSNWg@mail.gmail.com>
References <CANtuMdJMfLg4VXhuSowG-Tr1yzioACLWQqJHhgi49w4sJYSNWg@mail.gmail.com>
Date Thu, 29 Dec 2011 23:04:31 +1100
Subject Re: Help in rotate 13 program
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4215.1325160274.27778.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325160274 news.xs4all.nl 6879 [2001:888:2000:d::a6]:41851
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18167

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web