# conn = sqlite3.connect('first.db') # c = conn.cursor() # c.execute('select * from user_tb where _id>?', (2,)) # print('查询结果行数:', c.rowcount) # for col in c.description: # print(col[0], end="\t")
# print("\n----------------------")
# while True: # row = c.fetchone() # if not row: # break # print(row) # print(row[1] + "---->" + row[2])
# c.close() # conn.close()
# conn = sqlite3.connect('first.db') # c = conn.cursor() # c.execute('select * from user_tb where _id > ?', (2,)) # for col in c.description: # print(col[0], end='\t') # print('\n-------------------') # while True: # rows = c.fetchmany(3) # if not rows: # break # for r in rows: # print(r) # c.close() # conn.close()
conn = sqlite3.connect('first.db') conn.create_collation('sub_cmp', my_collate) c = conn.cursor() c.execute('select * from user_tb order by pass collate sub_cmp') for row in c: print(row) c.close() conn.close()