前言
最近在研究 pyecharts 的用法,它是 python 的一个可视化工具,然后就想着结合微信来一起玩
不多说,直接看效果:
环境配置
pip install pyecharts
pip install snapshot_selenium
pip install echarts-countries-pypkg
pip install echarts-china-provinces-pypkg
pip install echarts-china-cities-pypkg
pip install echarts-china-counties-pypkg
pip install wxpy
复制代码获取好友
主要是获取好友基本数据,用来做数据可视化
代码如下:
from wxpy import Bot, Chat
class Demo(Chat):
@staticmethod
def get_friend():
bot = Bot()
friends = bot.friends(update=True)
friend_data = []
for friend in friends:
if friend.sex == 1:
sex = "男"
elif friend.sex == 2:
sex = "女"
else:
sex = ""