[Python-checkins] CVS: python/dist/src/Lib this.py,NONE,1.1
Andrew Kuchling
akuchlin@mems-exchange.org
Fri, 8 Feb 2002 15:31:04 -0500
On Fri, Feb 08, 2002 at 12:13:49PM -0800, Fred L. Drake wrote:
>d = {}
>for c in (65, 97):
> for i in range(26):
> d[chr(i+c)] = chr((i+13) % 26 + c)
>
>print "".join([d.get(c, c) for c in s])
MAL's borrowed the time machine again. The above code
could just be written as:
print s.encode('rot-13')
--amk (www.amk.ca)
Ph-nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn.
-- H.P. Lovecraft, "The Call of Cthulhu"