import pymysql connection=None cursor=None try: connection=pymysql.connect('localhost','root','root','test1') cursor = connection.cursor() sql = 'insert into dept values (%s,%s,%s)' try: cursor.execute(sql,(80
python连接mysql
最新推荐文章于 2023-12-05 16:05:24 发布
本文介绍了如何使用Python的pymysql模块连接到MySQL数据库,包括建立连接、创建游标、执行SQL插入语句以及异常处理和关闭连接的步骤。
摘要由CSDN通过智能技术生成