0

I'm new to python, and I searched around didn't find any answer related to this, this is quite strange. Essentially, this is what I'm getting (I'm using python notebook, with python 2.7 )

In:'哈哈'
Out:'\xe5\x93\x88\xe5\x93\x88'

What should I do to make it display chinese properly?

ZK Zhao
  • 19,885
  • 47
  • 132
  • 206
  • How is it going in? `raw_input()`? – Tim Jul 15 '15 at 13:12
  • possible duplicate of [How to print Unicode character in Python?](http://stackoverflow.com/questions/10569438/how-to-print-unicode-character-in-python) – Tim Jul 15 '15 at 13:13

1 Answers1

2

You can print it properly by wrapping your string with print() function.

In[1]: print('哈哈')
Out[1]: '哈哈'

Or you can store it to a variable.

In[2]: input = '哈哈'
In[3]: print(input)
Out[3]: '哈哈'

Python interpreter uses repr() method to print out everything such as return value or variable's own value. You should use print() method explicitly to print it properly.

devunt
  • 347
  • 3
  • 9