【发布时间】:2010-09-27 14:03:58
【问题描述】:
browser = mechanize.Browser()
page = browser.open(url)
html = page.get_data()
print html
它显示了一些奇怪的字符。我想它是 UTF-8 字符串,但 Python 不知道,无法正确显示。
如何将此字符串转换为 unicode 字符串,如
u = u'test'
【问题讨论】:
-
告诉我们网址或页面上出现的一些奇怪字符。截至您的
UnicodeDecodeError,该文档绝对不是正确的UTF-8。
标签: python unicode encoding utf-8 mechanize