zoukankan      html  css  js  c++  java
  • python获取群成员信息

    #coding: utf-8
     
    import itchat,datetime
    from itchat.content import TEXT
    itchat.auto_login(hotReload=True)#不需要重复扫码登录
    class WeChat(object):
        def get_all_info_from_wechat(self):
            # itchat.auto_login(enableCmdQR = False)
            #获取群
            roomslist = itchat.get_chatrooms()
            #群名称
            itchat.dump_login_status() # 显示所有的群聊信息,默认是返回保存到通讯录中的群聊
            myroom=itchat.search_chatrooms(name=u'交流群') #群聊名称
            gsq=itchat.update_chatroom(myroom[0]['UserName'], detailedMember=True) 
            with open('群用户名.txt','w',encoding='utf-8')as f:
                f.write("交流群成员如下
    ")
                for i in gsq['MemberList']:
                    f.write('微信名:'+i['NickName']+'|群昵称:'+i['DisplayName']+'
    ')
                    print('微信名:'+i['NickName']+'|群昵称:'+i['DisplayName']+'
    ')
                f.close()
    if __name__ == '__main__':
        obj = WeChat()
        obj.get_all_info_from_wechat()
  • 相关阅读:
    UITextField的总结
    【实战】登录界面
    点分治学习
    2020/3/1
    2020/2/29
    2020/2/28
    2020/2/27
    2020/2/27
    最小树形图
    Ch’s gift HDU6162
  • 原文地址:https://www.cnblogs.com/xenli/p/12468806.html
Copyright © 2011-2022 走看看