B.py文件代码:
import pymysql
from MySQLHelper import MysqlHelper
name = input('请输入更正的学生姓名:')
id = int(input('请输入该学生的学籍编号:'))
sql = "UPDATE STUDENTS SET NAME=%s WHERE ID=%s"
sqlhelper = MySQLHelper.MysqlHelper('localhost',3306,'root','Eco0212@@','python3','utf8')
sqlhelper.MysqlHelper.cud(sql, params=[name, id])
运行提示错误:
E:\Python\protects>C:/Users/Administrator/AppData/Local/Programs/Python/Python37-32/python.exe e:/Python/protects/MySQL/mysql_updata.py请输入更正的学生姓名:ww请输入该学生的学籍编号:13Traceback (most recent call last): File "e:/Python/protects/MySQL/mysql_updata.py", line 7, in <module> sqlhelper = MySQLHelper.MysqlHelper('localhost',3306,'root','Eco0212@@','python3','utf8')NameError: name 'MySQLHelper' is not defined