我有一个名为getsomething(url)
的方法,它点击一个url并获取一些细节。此方法返回字典。现在,随着网址的变化,我希望这本字典已经被创建,以获得新的项目更新。如何做到这一点?你知道吗
我试过这个:
url_list = ['http:something.com','anotherthing.com']
def getdetails(url):
dict = {}
# some lines of code here...
return dict
它被称为:
for url in url_list:
result = {}
result = result.update(getdetails(url))
我得到了类似nonetype object is not iterable
的错误
我需要在同一个dict中的两个url的结果
要更新词典,你需要知道词典的外观。你知道吗
终端:
同时检查这个。在谷歌上搜索并不丢脸相信我。我一直认为这很正常。 https://www.journaldev.com/23232/python-add-to-dictionary
还要检查“item”==None或note以及if!=None他们进行更新“else”尝试检查错误并查看那里发生了什么。你知道吗
相关问题 更多 >
编程相关推荐