标签: python string unicode type-conversion
我正在尝试将此unicode:u"\u2605 adasdadad"转换为str并获得此异常:
u"\u2605 adasdadad"
str
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2605' in position 0: ordinal not in range(128)
请帮助。
答案 0 :(得分:3)
u"\u2605 adasdadad".encode("utf8")
也许