今天在用python写代码时
def write_datas(self, file_path, DATA):
with open("data.csv", 'w') as f:
writer = csv.writer(f)
for record in DATA:
writer.writerow(record)
在调用该函数时,报了这个传参错误,后来发现是因为类内函数,定义的时候没有加self,写成了def write_datas( file_path, DATA):
python解释器自动把self传入了函数,导致传参的数量超了,出现了错误告警。