geew
2014-02-20 09:11:43 +08:00
In [1]: t={u'src': u'[ Music ]', u'dst': u'\u97f3\u4e50'}
In [2]: rs=t.get('dst')
In [3]: print(rs) # 直接print就行了啊
音乐
In [4]: print(rs.decode('utf-8').encode('ascii')) # 中文encode ascii肯定会报这个错
---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
/home/geew/familyparty/<ipython-input-4-72fd90a6715b> in <module>()
----> 1 print(rs.decode('utf-8').encode('ascii'))