【发布时间】:2013-10-09 14:00:51
【问题描述】:
我想用短破折号 (-) 替换长破折号 (–)。我的代码:
if " – " in string:
string = string.replace(" – ", " - ")
导致以下错误:
SyntaxError:文件 ./script.py 中第 76 行的非 ASCII 字符“\xe2”,但未声明编码;详情见http://www.python.org/peps/pep-0263.html
我该如何解决这个问题?
【问题讨论】:
-
你读过 PEP 263 吗?
标签: python replace python-2.x