我想用短破折號(-
)代替長破折號(–
)。我的代碼: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