最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
python3 sqlite3限制条件查询操作代码
时间:2022-06-25 02:08:10 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下python3 sqlite3限制条件查询操作代码,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
请注意10,11,24行的代码,代码如下:
import json
import sqlite3
import re
import argparse
def Get(db_file):
conn = sqlite3.connect(db_file)
cur = conn.cursor()
print("5555555")
value1=(60)# this is must be ()
cur.execute("select * from exception where AGV_ID=(%s)" %(value1))
#cursor.execute("insert into exception values('%s', '%s','%s' ) " %(start_time ,ID ,infomation))
result= cur.fetchall()
print("result:",result)
for i in result:
print(i)
print("******************************888")
def get_agv_id(db_file):
try:
conn = sqlite3.connect(db_file)
cur = conn.cursor()
cur.execute("select * from exception where AGV_ID=51")
#print( cur.fetchall())
result= cur.fetchall()
for i in result:
print(i)
except sqlite3.Error,e:
print(e)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='check the information of db')
#parser.add_argument('-h', '--help', help='Statistics for abnormal information')
parser.add_argument('-n', '--name', help=' the db of name ')
args = vars(parser.parse_args())
db_name = args['name']
print("db_name:",db_name)
conn = sqlite3.connect('db_name')
cursor = conn.cursor()
Get('fitkits.db')
get_agv_id('fitkits.db')
conn.commit()
conn.close()
print('DONE!')
print("666")
相关文章
- 暗喻幻想:ReFantazio御剑滑行方法 10-29
- 暗喻幻想:ReFantazio黄金虫数量说明 10-29
- 暗喻幻想魔坏之锤获取方法攻略分享 10-29
- 暗喻幻想:ReFantazio难度更改说明 10-29
- 暗喻幻想古井死胡同BOSS打法攻略分享 10-29
- 骗子酒吧骗子骰子游戏规则介绍说明 10-29