报错信息就是save函数缺少一个值,但是这个值我传了...
missing 1 required positional arguments
代码片段:
这里调用了save_file里的save函数,并传递一个arry参数
def main(self,c): p_data = self.post_data(c) pa = p_data[0] pb = p_data[1] arry = self.content(pa,pb) save_file.save(arry)
这里把arry传入了save函数
def save(self,arry): param = self.create_excel() workbook = param[0] sheet = param[1] biaotou = [''] self.tab_head(sheet, biaotou) row = 1 for i, v in enumerate(arry): for j, k in enumerate(v): self.write_excel(sheet, row, j, k) file_path = 'E:/' row += 1 self.save_excel(file_path, workbook) print('写入完成!')
运行:
实例化的时候是加了括号的,也传参了,但是为啥会报这个错误呢...
if __name__ == '__main__': hk = hk() #实例化本类 save_file = save_file() #实例化save_file类 hk.main(c) print("程序完成!")
智慧大石
相关分类