【编码格式错误】SyntaxError: Non-UTF-8 code starting with


问题:

SyntaxError: Non-UTF-8 code starting with '\xba' in file E:/placement/placement/Placement Test/clTest.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

运行结果:

原因:编码格式不对

解决办法:

把相应Python程序文件的编码转成UTF-8格式

1、在文件第一行添加# encoding:utf-8

运行结果:

2.在文件第一行添加# -*- coding: gbk -*-

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM