次の文字列をデコードしてエラーを取得しようとしていました。次の文字列をデコードする方法
item = lh.fromstring(items[1].text).text_content().strip().decode('utf-8')
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u20a8' in position 0: ordinal not in range(128)
どのようなアイデアが間違っていますか?
items[1].text = <strong>₨ 18,500 </strong>
repr(items[1].text) = u'\u20a8 18,500'
あなたがお手伝いできるように、 'items [1] .text'の値を投稿してください。 –
関連http://www.fileformat.info/info/unicode/char/20a8/index.htm –
¥18,500 –