函数返回tuple怎么添加List里面(python环境下)

1、在python环境下调用函数返回tuple,将结果添加在list
list在循环前为空

2、代码如下:

result=[]
print(type(result))
for i in range(len(urllist)):
     print(i)
     add=urlget(urllist[i])
     print(type(add))
     result=result.append(add)
     print(type(result))

3、报错信息

0


1
Traceback (most recent call last):
File "C:/Users/123/PycharmProjects/urldownload/urlopentest.py", line 84, in
result=result.append(add)
AttributeError: 'NoneType' object has no attribute 'append'

1个回答

result=[]
print(type(result))
for i in range(len(urllist)):
print(i)
add=urlget(urllist[i])
print(type(add))
result.append(add)
print(type(result))

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问