Python实现对Mysql数据库的增删改查

2023-10-31

客户需求
使用Python脚本实现对对Mysql数据库的增删改查

import pymysql

# 显示
def readTable(cursor):
    # 选择全部
    cursor.execute("select * from premoney")
    # 获得返回值,返回多条记录,若没有结果则返回()
    results = cursor.fetchall()

    # 遍历打印
    for row in results:
        salesman = row[0]
        shool = row[1]
        admoney = row[2]
        print(salesman, shool,admoney, '\n')

    print("successfully show table"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Python实现对Mysql数据库的增删改查 的相关文章