怎么解決syntaxerror:non-utf-8 code starting with \xc4'in file


怎么解決syntaxerror:non-utf-8 code starting with \xc4'in file 

 
首行增加,已測試可用。
# coding=gbk
 
程序中出現中文,運行的時候出現如下錯誤:
 
SyntaxError: Non-UTF-8 code starting with 'xc1' in file C:...xxx.py on line 8, but no encoding declared; see  http://python.org/dev/peps/pep-0263/ for details
 
導致出錯的根源就是編碼問題。
解決方案是:
在程序最上面加上:
 
# coding=gbk
 
這樣程序就可以正常運行了
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM