python: int to unicode string

>>> import types
>>> print type(str(2))
<type 'str'>
>>> print type(str('2'))
<type 'str'>

# 这里先转为str,在转为unicode >>> print type(str(2).decode('utf-8')) <type 'unicode'> >>> print type(str('32').decode('utf-8')) <type 'unicode'> >>> print str(2).decode('utf-8') 2

 

posted on 2016-10-14 19:36  ZhYQ_note  阅读(938)  评论(0编辑  收藏  举报

导航