使用python3.8進行MySQL數據庫連接的時候,發現出現以下錯誤
init() takes 1 positional argument but 5 were given
而源代碼如下:
import pymysql db = pymysql.connect("localhost", "root", "xxx", "xxxx")
目前的一個解決方案是,為每個參數都指定到對應的參數名上:
db = pymysql.connect(host="localhost", user="root", password="xxx", database="xxxx")
可能是python3.8的函數在使用時需要指定參數名,否則會使用默認的參數模板
from:https://blog.csdn.net/qq_39598271/article/details/112610382
來源 https://www.cnblogs.com/xuan52rock/p/14328625.html