我想用短破折号(-
)代替长破折号(–
)。我的代码:Python,用短破折号代替长破折号?
if " – " in string:
string = string.replace(" – ", " - ")
导致以下错误:
SyntaxError: Non-ASCII character '\xe2' in file ./script.py on line 76, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
我怎样才能解决这个问题?
您是否阅读过PEP 263? – geoffspear