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):
self.data = value
def __repr__(self):
return `self.data`
Let's said I assign a chinese word to the class' instance.
x.data and x should return the same unicode like this
>>> x = chinese('你')
>>> x.data
'\247A'
>>> x
'\247A'
But when I try to print the two. They come out differently.
>>> print x.data
你
>>> print x
'\247A'
Is there any way that I can print the chinese word right?
>>> print x
你
Thanks and regard
Walter Wong