import sqlite3
def insert_dict_to_sqlite(dict_data, table_name):
conn = sqlite3.connect('example.db')
c = conn.cursor()
columns = ', '.join(dict_data.keys())
placeholders = ':'+', :'.join(dict_data.keys())
query = f'INSERT INTO {table_name} ({columns}) VALUES ({placeh
传入一个字典,python sqlite根据字典key和value插入的代码
最新推荐文章于 2024-03-07 10:51:20 发布