首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

求解,该如何处理

2012-04-28 
求解#encodingutf-8test[1,2,yes]test.append(apple) #追加到链尾test.extend([a,b,c]) #追加

求解
#encoding=utf-8
test=[1,2,"yes"]
test.append('apple') #追加到链尾
test.extend(['a','b','c']) #追加一个链表
test.insert(1, 'qq') #在1这个位置插入个‘qq’
print test

编译出错 找不出什么原因
SyntaxError: Non-ASCII character '\xd7' in file D:\python\hwm\1.py on line 13, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

[解决办法]
py文件的最前面加上这样一行:
#! -*- encoding:GB2312 -*-

热点排行