#!/usr/bin/env python2"""Demonstrate that raw_input() can return Unicode."""import sys class UnicodeFile: def readline(self, n=-1): return u'\N{SNOWMAN}' sys.stdin = UnicodeFile()s = raw_input()print type(s)print s
this is not read
<type 'unicode'>
Traceback (most recent call last): File "prog.py", line 12, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2603' in position 0: ordinal not in range(128)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!