Python中append以及extend返回None
lst=[]
lst2=lst.append(re.findall(r"[s][hz]\d{6}", href)[0])
print(lst2)
append方法只是在恰当的位置修改原来的列表。意味着,不是返回一个修改过的列表,而是直接修改原来的列表,所以代码中print函数中的lst.append()只是对列表进行了修改,不会有返回值。
lst=[]
lst.append(re.findall(r"[s][hz]\d{6}", href)[0])
print(lst)