【发布时间】:2013-11-26 06:56:55
【问题描述】:
当有多个列表传递给函数时,第一个打印系统工作。但是,当只传入一个列表时,我收到错误“AttributeError:'int' object has no attribute 'pop'”
此代码正在尝试从列表中删除一项,以查看该弹出项是否仍存在于剩余列表中。
def check_row(p):
for e in p:
while e:
x = e.pop()
if x in e:
return False
return True
print check_row([[8,2,3,4,5],
[2,3,1,5,6],
[4,0,2,3,1]])
print check_row([1,2,3,4,5])
非常感谢。
【问题讨论】:
标签: python list nested-lists