2
4

1 に答える 1

2

The small 'u' in front of the quote indicates that a Unicode string is supposed to be created.

>>> a = u'与'
>>> a
u'\u4e0e'

See the the string documentation for more information: http://docs.python.org/tutorial/introduction.html#unicode-strings

Update: Set the source file encoding according to the actual encoding of the file, so that the interpreter knows how to parse it.

For example, to use UTF-8 just add this string to the header of the file:

# -*- coding: utf8 -*-
于 2012-10-22T15:07:40.633 に答える