猫史档案馆


【Python作品分享】python 23

用户:李老师2020李老师2020查看:17 回复:2 评论:17 创建时间:2020-05-24T16:58:32


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import json,webbrowser,os
from pyecharts import Bar
with open ("birthday.json","r") as a:
    data=json.load(a)
b=[0]*12
for i in data:
    b[int(i)-1]+=1
x=["1","2","3","4","5","6","7","8","9","10","11","12"]
y=b
bar=Bar("出生月份统计")
bar.add("",x,y)
bar.render()
webbrowser.open("file://"+os.path.realpath("render.html"))

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
三百克薄荷油三百克薄荷油

根据PEP8编码规范,您的第一行应该改成:

import json
import webbrowser
import os

点赞0


评论


三百克薄荷油三百克薄荷油

Imports

点赞0


评论