ADD file via upload

master
hnu202109060319 2 years ago
parent acf4b3d896
commit 1a10dd4b34

@ -0,0 +1,35 @@
import washer,contentout
contentout.start()
with open('content.txt', 'r+', encoding='utf-8') as f:
content = f.read()
message = washer.process(content)
author = []
favor = {}
print(message)
for video in message:
if video[2] not in author:
author.append(video[2])
favor[video[2]] = eval(video[3])
elif video[2] in author:
favor[video[2]] += eval(video[3])
import matplotlib.pyplot as plt
# 用黑体显示中文
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['figure.figsize'] = (10, 5) # 设置figure_size尺寸
# 绘制柱状图
plt.bar(favor.keys(), favor.values())
plt.xlabel("作者",fontsize=14)
plt.ylabel("点赞数目",fontsize=14)
# 每个扇形的标签
labels = favor.keys()
# 每个扇形的占比
sizes = favor.values()
fig1, ax1 = plt.subplots()
# 绘制饼图
ax1.pie(sizes, labels=labels, autopct='%d%%',radius=1,textprops={'fontsize': 10}, startangle=90)
ax1.axis()
plt.show()
Loading…
Cancel
Save