大家去试试这个,有意思
def func(b,a = []): if b: a = b return a b = [3] print(func(b),func(None)) # 结果:([3], []) def func2(b,a = []): if b: a.append(b) return a b = 3 print(func2(b),func2(None)) # 结果:([3], [3])
Sign in to make a reply
v贝塔v
大家去试试这个,有意思