android 清空list集合,list.clear()与list = []有何不同?
该功能的预期目标foo是将作为参数提供的数字添加到列表中,如果该数字为0,则重置列表。首先我写了这个程序:def foo(n, bar = []):if n == 0:bar = []print("list empty")else:bar.append(n)for y in bar:print(y, end=', ')print()foo(5)foo(3)foo(0)foo(6)输出:5,5, 3...