摘要: 数据读取: 1、使用 fetchone() 方法获取单条数据 data = cursor.fetchone() print(data) 2、使用fetchall()方法获取多条数据 rows = cur.fetchall()for row in rows: print(row) 阅读全文
posted @ 2022-12-10 18:22 小仙女、 阅读(201) 评论(0) 推荐(0)
摘要: 前提:电脑已经安装数据库环境 1、导入pymysql库 2、建立连接: md = pymysql.connect(host='localhost',user='root',password='数据库密码',db='lili') 3、新建游标: cur = md.cursor() 4、写sql sql 阅读全文
posted @ 2022-12-10 18:11 小仙女、 阅读(28) 评论(0) 推荐(0)