我试图构建一个包含列表中第二个元素的列表。我首先抓取了一些链接并存储在links_2016
for i in links_2016:
parsed = urlparse.urlparse(i)
path = parsed[2]
pathlist = path.split("/")
list_pathlist.append(pathlist)
#get the months
months = []
for i in range(0,44): #there are 44 elements in list_pathlist
list_pathlist[i][2] #get the second element
months.append
但当我打印月份时,列表中会出现内置的方法消息:
^{pr2}$在这之后,当我做print months
时,我只得到[]
,这意味着结果有问题。在
我还需要计算月列表中的元素,所以我想学习如何解决这个问题。在
希望它现在起作用
^{1}$要计算月份列表中的元素,请执行
len(months)
相关问题 更多 >
编程相关推荐