pywin32com 使用PivotField的Subtotals错误

在设置透视表的分类汇总时发现不能使用PivotField.Subtotals(1) = True这种形式,会提示SyntaxError: cannot assign to function call错误
检查Subtotals类型是tuple,这意味着python是一次性取得所有属性,不能单独赋值,只能一次性赋值,所以应使用如下形式:
PivotField.Subtotals = [False, False, False, False, False, False, False, False, False, False, False, False]

posted on 2021-06-03 09:57  小猪*码  阅读(221)  评论(0)    收藏  举报

导航