有没有关于如何在Python中实现表格(即小型关系数据库)的最佳方法,而不使用任何外部数据库额外模块和当sqlite3模块损坏或缺失时的想法。
user:~ $ python3
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/bns/rma/local/python/lib/python3.1/sqlite3/__init__.py", line 24, in <module>
from sqlite3.dbapi2 import *
File "/bns/rma/local/python/lib/python3.1/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
>>> ^D
user:~ $ python2.7
Python 2.7 (r27:82500, Jul 28 2010, 11:39:31)
[GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dcottr/local/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/home/dcottr/local/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
>>>
sqlite3
,而不是sqlite
,如果搜索“python sqlite”,就会知道)。-1分,连尝试都没有。 - Glenn Maynard