zoukankan      html  css  js  c++  java
  • python自动化

    人生苦短,我用python

    越学python,越觉得python好玩,特别是自动化和人工智能

     

    1.微信登录和退出
     1 #!/usr/bin/env python3
     2 # coding:utf-8
     3 # 2019/11/2 1:53
     4 #lanxing
     5 #微信登录和登出
     6 from wxpy import *
     7 
     8 #初始化机器人,扫码登录
     9 #cache_path保持登录,Bot初始化中可以加入参数:console_qr是否在可控制台显示二维码
    10 bot = Bot(cache_path=True)
    11 print("登录成功")
    12 
    13 bot.logout()
    14 print("成功退出登录")



    2.阻塞进程,保持登录状态
     import wxpy bot = wxpy.Bot(cache_path=True) bot.join() 



    3.找到自己微信里面的所有朋友的个人信息,省份,城市,昵称等信息
     1 #!/usr/bin/env python3
     2 # coding:utf-8
     3 # 2019/11/2 1:53
     4 #lanxing
     5 from wxpy import *
     6 
     7 bot = Bot(cache_path=True,console_qr=False)
     8 #启用 puid 属性 ,并指定puid 所需的映射数据保存/载入路径
     9 bot.enable_puid('wxpy_puid.pkl')
    10 friends = bot.friends()
    11 sex_male = 0
    12 sex_femal = 0
    13 unkown = 0
    14 for i in range(len(friends)):
    15     #friends[i]拥有的属性列表
    16     print('friends[i]:	',friends[i])  #聊天对象格式为: <Friend:备注名称>
    17     print('nick_name:	' + friends[i].nick_name)  #微信好友的微信昵称
    18     print('name:	',  friends[i].name)  #扫码用户的该微信好友的备注
    19     print('remark_name:	' + friends[i].remark_name)
    20     print('bot:	', friends[i].bot)  #机器人对象 格式为: <Bot: 备注名称
    21     print('raw:	',  friends[i].bot) #微信好友对应的用户详细信息json数据
    22     print('puid:	' , friends[i].puid)  #微信好友对应的puid值
    23     print('NickName:	' + friends[i].raw['NickName']) #打印备注信息
    24     print('Province:	' + friends[i].raw['Province'])  #打印好友所在省份
    25 
    26     print('City:			' + friends[i].raw['City'])  #城市
    27     #男性 sex值为1, 女性值为2 末提供为0
    28     print(friends[i].raw['Sex'])
    29 
    30     if friends[i].raw['Sex'] == 1:
    31         sex_male +=1
    32     elif friends[i].raw['Sex'] == 2:
    33         sex_femal +=1
    34     else:
    35         unkown +=1
    36 
    37 print('count of male is:' , sex_male,'count os female is :',sex_femal,'不知道性别的共:',unkown)
    38 print('共有好友:',len(friends))
    
    


    4.最后
    哈哈,相信你们也看到了,怕大佬社工我,我就打码了,信息点很多,很方便,自动化统计
    
    
  • 相关阅读:
    MSDN RSS Feeds (ZT)
    不錯,今天看到日历了.
    模糊:让你的代码远离偷窥之眼
    .NET中異常發布器的開發(1)(2)(3)
    How To Query Performance Monitor Counters Using a Web Page
    可選參數的Stored Procedure範例.
    Outlook GetCurrent Folder / GetSelectedItems / GetInspectors
    微軟的MS04007补丁有严重问题啊.
    Blog,流行有理由 (zt)
    从VB.Net到VB6.0要小心,关于使用IIF和log求对数函数(串联的小知识)
  • 原文地址:https://www.cnblogs.com/lanyincao/p/11783732.html
Copyright © 2011-2022 走看看