Python3之wxpy,pyecharts的使用

from pyecharts import *
from wxpy import *

bot = Bot(cache_path=True)
my_friend = bot.friends().search("ur friend's name", sex=FEMALE, )[0]


# print(my_friend)


# 发送文本
# my_friend.send('测试,测试!')
# 发送图片
# my_friend.send_image(r'C:\Users\Quincy_C\Desktop\123.jpg')
@bot.register()
def print_others(msg):
    print(msg)


@bot.register(my_friend)
def reply_my_friend(msg):
    print('received:{} ({})'.format(msg.text, msg.type))


friends_stats = bot.friends().stats()
print(friends_stats)
attr = []
v1 = []
friends_loc = []
for province, count in friends_stats['sex'].items():

    friends_loc.append([province, count])

friends_loc.sort(key=lambda x: x[1], reverse=True)

for p, c in friends_loc[:5]:

    attr.append(p)
    v1.append(c)

pie = Pie('省份数量统计')
pie.add('', attr, v1, is_label_show=True, center=[50, 60])
pie.render()
# embed()
# bot.join()

猜你喜欢

转载自blog.csdn.net/qq_33733970/article/details/80731615