Question: __repr__ can't print unicode right

Walter Wong h2owong at
Wed Nov 22 03:36:13 CET 2000

I am trying to write a class that handle Chinese big5 code.  But find
some problem in printing the __repr__ value.

>>> class chinese:
	def __init__(self, value): = value
	def __repr__(self):
		return ``

Let's said I assign a chinese word to the class' instance. and x should return the same unicode like this

>>> x = chinese('你')
>>> x

But when I try to print the two.  They come out differently.

>>> print
>>> print x

Is there any way that I can print the chinese word right?
>>> print x

Thanks and regard

Walter Wong

More information about the Python-list mailing list