先要安装AccessDatabaseEngine_X64.exe
-
#!/usr/bin/env python
-
# -*- conding: utf-8 -*-
-
-
import pypyodbc
-
if __name__=="__main__":
-
-
str = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=E:\\1.mdb'
-
conn = pypyodbc.win_connect_mdb(str)
-
#conn = pypyodbc.connect(str)
-
cur = conn.cursor()
-
cur.execute("SELECT * FROM catalog")
-
for row in cur.fetchall():
-
for field in row:
-
print field,
-
print ''
-
conn.commit()
-
cur.close()
-
conn.close()
阅读(984) | 评论(0) | 转发(0) |