#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2010 Doug Hellmann. All rights reserved. # """Demonstrate a non-Unicode codec. """ #end_pymotw_header import codecs from cStringIO import StringIO buffer = StringIO() stream = codecs.getwriter('rot_13')(buffer) text = 'abcdefghijklmnopqrstuvwxyz' stream.write(text) stream.flush() print 'Original:', text print 'ROT-13 :', buffer.getvalue()