Why does the TypeError occur when __init__() expects 1 argument but receives 5?

2026-06-09 11:350阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计91个文字,预计阅读时间需要1分钟。

Why does the TypeError occur when __init__() expects 1 argument but receives 5?

以下为简化后的代码内容:使用pymysql连接数据库,配置信息如下:dbhost='localhost'dbuser='root'dbpass='123456'dbname='mrsoft'db=pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)


Why does the TypeError occur when __init__() expects 1 argument but receives 5?

以下为解决方案:

dbhost='localhost'
dbuser='root'
dbpass='123456'
dbname='mrsoft'

db=pymysql.connect(host=dbhost,user=dbuser,password=dbpass,database=dbname)