Combine the list returned by `re.findall()`
This question already has an answer here:
尝试reduce(sum, line)
:
def extractDollar(line):
global mainList
temp=[]
#lowercasing all the string
line=line.lower()
#storing all word starting with $ in a line in temp
#then adding that to existing list mainList
#to form a single list and removing empty value
temp= re.findall(r'$w+',line)
mainList=mainList+[j for i in zip(mainList,temp) for j in i]
mainList= filter(None, mainList)
return reduce(sum,line)
链接地址: http://www.djcxy.com/p/22560.html