使用Eclipse与Pydev编写Python一个小程序出现问题。

在网上看了很普遍的关于这方面的教程,想写一个“heloworld”试试,出现了下面截图上的问题,由于是新手,摸不着头脑,所以请各位帮忙看一下。

SyntaxError: Non-ASCII character '\xc4' in file C:\Users\Unravel\workspace\HelloWorld\helloworld.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

第1个回答  2014-10-17
是python2.x还是python3.x?
python2.x的话 print 'hello world'
python3.x的话 print ('hello world')

另外把注释全部删了,再试试看。本回答被网友采纳
第2个回答  2014-10-17
开头加上一行# coding:utf8试试追问

可以了!谢谢,请问是为什么?

追答

你开头注视里,带有日期中含有中文,有乱码

本回答被提问者采纳
相似回答