使用tkinter + sqlite3时出错

时间:2014-04-21 15:45:02

标签: python sqlite tkinter

我试图在gui(Tkinter)中使用sqlite3,当我尝试使用geany编译代码时,它会返回此错误

File "/home/armando/Documents/curso/python_projects/sqlite3.py", line 3
SyntaxError: Non-ASCII character '\xc3' in file /home/armando/Documents/curso/python_projects/sqlite3.py on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

我如何解决这个问题?

由于

光与和平!

1 个答案:

答案 0 :(得分:1)

见pep 263 - http://legacy.python.org/dev/peps/pep-0263/

您必须在源模块的顶部声明您的编码:

#!/usr/bin/python
# -*- coding: utf-8 -*-

将utf-8替换为您保存文件的编码。