#概要#
AttributeError: ‘set’ object has no attribute ‘append’ ##将items={0} 改为 items=[] 问题解决。
items=[]#此处为修改后的代码,原代码是:items={0}
p_={0}
p_={‘0’,‘1’,‘2’,‘3’,‘15’}
p_end=0
#p_=re.findall(regA,html)
#end1 = time.time()
#print("Page数据组装OK!用时:%f" %(end1-start1))
print(p_)
for t in p_:
print(t)
t_t=int(t)
if (p_end < t_t <= 10 ) :
p_end=t_t
print("p_end: %d" %p_end)
for p in range(1,p_end+1):
items.append(p)#AttributeError: 'set' object has no attribute 'append' ##将items={0} 改为 items=[] 问题解决。
print(items)
原因:参考:
python三类数组:
1、Python的数组分三种类型:
(1) list 普通的链表,初始化后可以通过特定方法动态增加元素。
定义方式:arr = [元素]
(2) Tuple 固定的数组,一旦定义后,其元素个数是不能再改变的。
定义方式:arr = (元素)
(2) Dictionary 词典类型, 即是Hash数组。
定义方式:arr = {元素kv}