Tôi đang cố in chuỗi từ archived web crawl, nhưng khi tôi gặp lỗi này :UnicodeEncodeError: 'ascii' codec không thể mã hóa ký tự u ' xe7' ở vị trí 17710: thứ tự không nằm trong phạm vi (128)
print page['html']
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 17710: ordinal not in range(128)
Khi tôi cố gắng in unicode(page['html'])
tôi nhận được:
print unicode(page['html'],errors='ignore')
TypeError: decoding Unicode is not supported
Bất kỳ ý tưởng làm thế nào tôi có thể đúng mã chuỗi này, hoặc ít nhất là có được nó để in? Cảm ơn.
http://farmdev.com/talks/unicode/ –
Đây là câu hỏi python phổ biến nhất hiện nay. – KurzedMetal