Advertisement
rfmonk

codecs_ROT13.py

Jan 29th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. #1/usr/bin/env python
  2.  
  3. # this is from The Python
  4. # Standard Library by example
  5. # ISBN13: 9780321767349
  6.  
  7. import codecs
  8. from cStringIO import StringIO
  9.  
  10. buffer = StringIO()
  11. stream = codecs.getwriter('rot_13')(buffer)
  12.  
  13. text = 'abcdefghijklmnopqrstuvwxyz'
  14.  
  15. stream.write(text)
  16. stream.flush()
  17.  
  18. print 'Original:', text
  19. print 'ROT-13  :', buffer.getvalue()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement