我有一个从谷歌学者那里抓取的字典列表,看起来像这样,
WRT_Citations = {Citations: 201, year: 2008, Title: Something, Author: Authors, Url: Url} {Citations: 108, year: 2006, Title: Something, Author: Authors, Url: Url}{Citations: 100, year: 2009, Title: Something, Author: Authors, Url: Url}
我把它放在这个 for 循环中以使其更有条理。
for Citations in Wrt_Citations:
print "Print Citations ", Citations
这给出了一个更有序的列表,
output = {Citations: 201, year: 2008, Title: Something, Author: Authors, Url: Url}
{Citations: 108, year: 2006, Title: Something, Author: Authors, Url: Url}
{Citations: 100, year: 2009, Title: Something, Author: Authors, Url: Url}
我想获得总引文,即 201 + 108 + 100 = 409。我已经能够单独获得引文,
Cites = dict.values(Citations)[0]
print cites = 201
108
100
所以我尝试使用 sum(dict.values(Citations)[0]) 来获取总引用,但这只是给出 TypeError: 'int' object is not iterable。
任何帮助都会很高兴地被排除在外,我一直在自学,过去几周通过 tril and error python 所以有些术语我不正确,请提前抱歉,哦,列表已经排序了两次,重复的也被删除了你知道。