[英]Using html2text with html utf8
I have problem with html2text 我对html2text有问题
input = "<h1 itemprop="name">Bò 33 Món</h1>"
I use 我用
from stripogram import html2text
print html2text(input)
print html2text(input.decode('utf8'))
And my result 而我的结果
B 33 Mn
Result I need 结果我需要
Bò 33 món
How can I do it? 我该怎么做?
The result of html2text(input)
is Unicode. html2text(input)
的结果是Unicode。 To print it with print
, you need to get it back down to 8-bits per character by converting it to UTF-8: 要使用print进行
print
,您需要通过将其转换为UTF-8来将其降为每个字符8位:
from stripogram import html2text
print html2text(input).encode('utf-8')
which will print 将打印
# Bò 33 Món
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.