Jupyter Notebook: How to output chinese?
<p>The coloumn ['douban_info'] in my dataset is info about movies in Chinese which stored in JSON, so when I do <code>df['douban_info'][0]</code>, it returns</p>

<p><a href="http://i.stack.imgur.com/6WCkU.png" rel="nofollow"><img src="http://i.stack.imgur.com/6WCkU.png" alt="enter image description here"></a></p>

<p>The chinese are all changed into things like <code>\u7834\u6653\u8005</code>, which I can't read with ease. Is it possible to make python to turn them into the originall chinese when outputing?</p>

<p>I'm on Python 2.7.</p>

<p>This is how Python 2 works.  It by default displays the <code>repr()</code> when generating display strings for lists and strings.  You have to <code>print</code> strings to see the Unicode characters:</p>

<pre><code>&gt;&gt;&gt; D = {u'aka': [u'2019\u730e\u8840\u90fd\u5e02(\u6e2f)', u'\u9ece\u660e\u65f6\u5206']}
&gt;&gt;&gt; D[u'aka'][0]
u'2019\u730e\u8840\u90fd\u5e02(\u6e2f)'
&gt;&gt;&gt; print D[u'aka'][0]
2019çè¡é½å¸(æ¸¯)
</code></pre>

<p>If you can't move to Python 3, you'll have to make your own display routine if you don't like the default <code>repr()</code> display.  Something like:</p>

<pre><code>D = {u'aka':[u'2019\u730e\u8840\u90fd\u5e02(\u6e2f)',u'\u9ece\u660e\u65f6\u5206']}

def dump(item):
    L = []
    if isinstance(item,dict):
        for k,v in item.items():
            L.append(dump(k) + ':')
            L.append(dump(v))
        return '{' + ', '.join(L) + '}'
    elif isinstance(item,list):
        for i in item:
            L.append(dump(i))
        return '[' + ', '.join(L) + ']'
    else:
        return "u'" + item + "'"

print dump(D)
</code></pre>

<p>Output:</p>

<pre><code>{u'aka':, [u'2019çè¡é½å¸(æ¸¯)', u'é»ææ¶å']}
</code></pre>

<p>Note this is by no means complete as a generic dumping utility.</p>

<p>In Python 3 <code>repr()</code> has been updated:</p>

<pre><code>&gt;&gt;&gt; print(D)
{'aka': ['2019çè¡é½å¸(æ¸¯)', 'é»ææ¶å']}
</code></pre>

python unicode jupyter-notebook