【发布时间】:2011-02-24 16:41:04
【问题描述】:
我有一堆使用 Python 中的 HTTPLIB2 包下载的 HTML 文件。 ' ' 显示为 'Â'。
<font color="#ff0000">02/12/2004Â </font> is showing while <font color="#ff0000">02/12/2004 </font> is the desired format.
如何在 Python 中将 'Â ' 替换为 '&nbsp;'?非常感谢!
【问题讨论】:
-
是的,它与原始 HTML 略有不同。我正在使用 httplib2 下载它们,而不是真正的浏览器。我必须在 httlib2 的标题中包含一些内容才能按原样下载页面吗?
标签: python non-ascii-characters replace