我有一段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.为我工作