用户:洪斌酱查看:0 回复:1 评论:0 创建时间:2019-11-17T19:04:07
【作品展示】

【作品介绍】
随便下载一个birsday的txt
【作品源代码】
# 统计图
import json
import webbrowser
import os
from pyecharts import Bar # 导入素材库
with open("birthday.json", "r") as f:
data = json.load(f)
print(data)
# for i in data:
# print(int(i))
# print(len(data))
list_month = [0] * 12
# print(list_month)
for i in data:
list_month[int(i)-1] += 1
print(list_month)
x_axis = ["1月", "2月", "3月", "4月", "5月","6月", "7月", "8月", "9月", "10月", "11月", "12月"]
y_axis = list_month
bar = Bar("生日月份统计")
bar.add("",x_axis,y_axis)
bar.render()
webbrowser.open("file://" + os.path.realpath("render.html"))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn