TypeError:write()至多需要5个参数(给出6个)Python Excel

我需要input这个参数。 但python不让我input超过5.有没有办法?

sheet.write(26, 0, "Index", center, bold, timeFormat) 

您可以通过将属性字典传递给add_format()构造函数来设置多个格式属性:

 format = workbook.add_format({'bold': True, 'align': 'center'}) 

然后,不要像分开地传递“中心”和“大胆”一样,你可以调用:

 sheet.write(26, 0, "Index", format, timeFormat)