[英]why in python giving to str func a unicode string will throw an exception?
[英]python unicode to str exception
我正在嘗試將此unicode轉換: u"\★ adasdadad"
為str
並得到以下異常:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2605' in position 0: ordinal not in range(128)
請幫助。
u"\u2605 adasdadad".encode("utf8")
也許
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.