Python Unicode 转换 字符串

estimate_price = "\u00a340\u00a0\u00a0-\u00a060"
sold_price = "Sold for \u00a345"

 

转换代码:

 

 print type(estimate_price)
 print type(sold_price)

estimate_price = estimate_price.decode('unicode_escape')
sold_price = sold_price.decode('unicode_escape')

print estimate_price
print sold_price

 

输出结果是:

 

<type 'unicode'>
<type 'unicode'>
£40  - 60
Sold for £45

 

posted @ 2017-07-27 21:06  淋哥  阅读(2518)  评论(0编辑  收藏  举报