-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite.py
More file actions
35 lines (27 loc) · 698 Bytes
/
sqlite.py
File metadata and controls
35 lines (27 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
#操作sqlie数据库
import sqlite3
import json
import sys
import platform
conn = sqlite3.connect('test.db')
cursor = conn.cursor()
cursor.execute('select * from lmm order by id desc')
values = cursor.fetchall()
#cursor.execute('insert into lmm values(3,"cc")')
#关闭连接
cursor.close()
conn.close()
def showData(val):
for i in val:
print(type(i))
print(json.dumps(i))
print(type(json.dumps(i)))
if __name__ == '__main__':
platform = platform.platform()
if 'Windows' in platform:
print(platform)
print(__name__)
print(sys.argv)
showData(values)
#python操作mysql数据库的方式与sqlite基本大同小异