摘要: 1、二维元组或列表转为字典 tup = [["zhang3", "x"], ["li4", "y"], ["wang5", "z"]] tupToDict = dict(tup) print(tupToDict) 2、将键值对转为字典 print(dict(a=1, b=2)) 阅读全文
posted @ 2023-01-09 15:43 码上测 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 基础功能 import sqlite3 # sqlite一个文件就是一个库 # 连接test.db数据库,没有就创建 conn = sqlite3.connect('test.db') # 创建一个cursor cur = conn.cursor() # 创建表 table_name = "comp 阅读全文
posted @ 2023-01-09 11:41 码上测 阅读(114) 评论(0) 推荐(0) 编辑