最新下载
热门教程
- 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")
相关文章
- 四海兄弟故乡人物边缘模糊怎么办 人物边缘模糊解决方法 08-21
- 四海兄弟故乡神秘狐狸06怎么找 神秘狐狸06位置介绍 08-21
- 四海兄弟故乡神秘狐狸05怎么找 神秘狐狸05位置说明 08-21
- 诛仙2四海战歌奇遇怎么做 四海战歌东海奇遇收集 08-21
- 四海兄弟故乡神秘狐狸04怎么找 神秘狐狸04位置一览 08-21
- 四海兄弟故乡城市有多少 城市地点背景介绍 08-21