TypeError: __init__() takes 1 positional argument but 5 were given
这是错误,我将分享以下脚本:
import pymysql
print('---DATABASE CONNECTION SAMPLE---')
x=pymysql.connect('localhost','root','sha@123','avodha')
cr=x.cursor()
cr.execute('create table student(name char(50),age int)')
x.close()
connect
不接受位置参数,它接受关键字参数:
x = pymysql.connect(host='localhost',
user='user',
password='passwd',
database='avodha')
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)