我刚得到 python 并输入:
sqlite test.db
进入 shell,但出现语法错误。我错过了什么?
请您参考如下方法:
我猜你做了以下事情?
$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> sqlite test.db
File "<stdin>", line 1
sqlite test.db
^
SyntaxError: invalid syntax
试试这个:
import sqlite3
conn = sqlite3.connect('test.db')
cursor = conn.cursor()
cursor.execute('''Your query goes here''')
