我有一段Python代码:
def func1():
a=set()
b = ','.join(map(str, list(a)))
return b, []
def func2():
d = 1
e = 2
return func1() + (d, e,)
def main():
a,b,c,d = func2()
if __name__ == '__main__':
main()
当我通过
pylint
(1.4.0)运行它时,我收到警告:W: 12, 4: Possible unbalanced tuple unpacking with sequence: left side has 4 label(s), right side has 3 value(s) (unbalanced-tuple-unpacking)
看来
func2
总是会返回四个结果。错误是什么意思,为什么? 最佳答案
如果警告是错误的,则可以通过将# pylint: disable=unbalanced-tuple-unpacking
附加到该行来禁用警告。