python中查找列表中的数值_Python:在列表中查找值

def sum_points(point_list):

sol = []

sum = 0.0

for x in point_list:

sum += x

sol.append(sum)

return sol

def main():

with open("example.json") as f:

for line in f:

result = json.loads(line)

if('text' and 'place' in result.keys()) and (type(result['place']) is dict):

place_user = result['place']

tw_user = result['text']

words = tw_user.encode("utf-8").split()

points = dict.fromkeys(words,0)

with open("wordlist.txt") as f:

for line in f:

key, val = line.split("\t")

if key in points:

points[key.strip()] += int(val)

point_list = sum_points(points.values())

addr_code = place_user['full'].encode("utf-8").split()从我的代码中ÿ

你可能感兴趣的:(python中查找列表中的数值)