python sqlite 时间查询

来源:互联网 发布:慕课网php百度网盘 编辑:程序博客网 时间:2024/05/19 12:39
conn = get_conn(sqlite_path+os.sep+dbfile)table_sql = "select name from sqlite_master where type='table' order by name"cu = get_cursor(conn)cu.execute(table_sql)tablenames = cu.fetchall()# print('tablenames:',tablenames) # [('sh600152',), ('sh600228',),..]for symbol_table in tablenames:    fetchall_sql = '''SELECT * FROM ''' + symbol_table[0] + """ where((strftime("%H",time)='09')and(strftime("%M",time)>='30')and(strftime("%M",time)<'31'))"""    print(fetchall_sql)    cu.execute(fetchall_sql)    data = cu.fetchall()    print (data)
原创粉丝点击