openpyxl单元格属性的名称,可以用变量设置吗
想检测对比一下,两个excel 表格中的样式,不愿一个一个去试,打算用 循环来做,可是提示错误。
def ceshi():
compares = ['font', 'border', 'fill', 'number_format', 'protection', 'alignment']
for pro in compares:
if target_cell.pro == source_cell.pro:
print(pro)
ceshi()
出错信息:AttributeError: 'Cell' object has no attribute 'pro'
请教 :openpyxl单元格属性的名称,可以用变量设置吗