[code.view]

[top] / python / PyMOTW / codecs / codecs_stdout.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Printing unicode text to sys.stdout.
     """
     #end_pymotw_header
     
     import codecs
     import sys
     
     text = u'pi: π'
     
     # Printing to stdout may cause an encoding error
     print 'Default encoding:', sys.stdout.encoding
     print 'TTY:', sys.stdout.isatty()
     print text
     

[top] / python / PyMOTW / codecs / codecs_stdout.py

contact | logmethods.com