错误:
一.TypeError:object of type 'NoneType' has no len()
list=[] i=0 j=0 while len(list)<=len(nums1)+len(nums2):
报错:TypeError:object of type 'NoneType' has no len()
原因:此时的list是空列表,它的类型是None而不是list,这时候可以改为
while list==None or len(list)<=len(nums1)+len(nums2):
二.AttributeError: 'NoneType' object has no attribute 'append'
nums=nums.append('a')
报错:AttributeError: 'NoneType' object has no attribute 'append'
原因:append()函数没有返回值,不需要再赋给nums,应改为:
nums.append('a') print(nums)
标签:no,object,list,len,NoneType,append From: https://www.cnblogs.com/rxh-321/p/17236116.html