本篇文章小编给大家分享一下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")
孢子2生物进化中文版(Spores)
孢子2生物进化中文版让我们来做一回疯狂的博士,打造一个属于自
叫我万岁爷九游官方版
叫我万岁爷带你体验当换地点感觉,全新的模拟手游大作让你开始一
梦回凤歌
梦回凤歌手游中你将步入古代的宫廷纷争之中,本想度过美好幸福的
洋果子店rose最新版本
洋果子店最新版是一款十分容易让人垂涎的开店经营类手游。游戏玩
明日大亨最新版
明日大亨手游,一个非常经典有趣的模拟经营类型的商战手游,在游