在此插入代码
def a(L=None): if L is None: L=[] L.append('ENd')
return L
a() ['ENd'] a(1) a(1,2,3) Traceback (most recent call last): File "<pyshell#118>", line 1, in <module> a(1,2,3) TypeError: a() takes from 0 to 1 positional arguments but 3 were given
a() ['ENd'] a(1)
a(1,2,3) Traceback (most recent call last): File "<pyshell#118>", line 1, in <module> a(1,2,3) TypeError: a() takes from 0 to 1 positional arguments but 3 were given
注意你return的位置有误
传递多个参数要写成list的形式,例如:a([1,2,3])
L.append('ENd') 此方法只属于list 吗?
Sign in to make a reply
Dicetequiero