Commit 027ee47b authored by 张彦钊's avatar 张彦钊

change tets

parent 1a474266
...@@ -26,12 +26,16 @@ def get_user_profile(): ...@@ -26,12 +26,16 @@ def get_user_profile():
tags = {} tags = {}
for i in tmp: for i in tmp:
tags[i["content"]] = i["score"] tags[i["content"]] = i["score"]
tags = sorted(tags.items(), key=lambda x: x[1], reverse=True) tag_sort = sorted(tags.items(), key=lambda x: x[1], reverse=True)
if len(tags) > 5: tags = []
tag_score = tags[:5] if len(tag_sort) > 5:
print(tag_score) for i in range(5):
tags.append(tag_sort[i][0])
print(tags)
return tag_score return tag_score
else: else:
for i in tag_sort:
tags.append(tag_sort[i][0])
print(tags) print(tags)
return tags return tags
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment