Python实现手机号自动判断男女性别(实例解析)
Python  /  管理员 发布于 7年前   242
本文性别判断主要依靠airtest中的自动化测试实现
通过自动对比支付宝页面男女图像,从而实现男女判断
代码如下:
男女判断函数:
// An highlighted blockdef numbe(): if exists(Template(r"tpl1574867500094.png", threshold=0.85, rgb=True, target_pos=0, record_pos=(0.779, 0.382), resolution=(960, 540))): sex = "女" if exists(Template(r"tpl1574924960910.png", threshold=0.89, rgb=True, target_pos=5, record_pos=(0.779, 0.382), resolution=(960, 540))): sex = "男" else: sex = "不存在" namesex = sex keyevent("4") return namesex手机滑动(根据手机分辨率自行调整):// An highlighted blockdef scoll(): try: swipe(v1=(629, 1750),v2=(629, 310)) # 滑动距离需要根据手机分辨率自行调整 except: print("can't go back to the main page")
刷选函数:
// An highlighted blockdef number(): data_list =[] for i in range(9): # 根据手机分辨率自行调整 try: title =poco(name="com.alipay.mobile.contactsapp:id/contact_item_name")[i].get_text() name = poco(name="com.alipay.mobile.contactsapp:id/concast_from")[i].get_text() print(title) name_a =name[5:6] if title not in data_list and name_a is not "1": poco("com.alipay.mobile.contactsapp:id/contact_item_name")[i].click() sexname=numbe() if sexname =="男": print(str(sexname)) else: print(str(sexname)) else: print(name_a) print("不存在") except: print("出错,跳过!")
综合:
// An highlighted block# -*- encoding=utf8 -*-__author__ = "liuqingsong"def numbe(): if exists(Template(r"tpl1574867500094.png", threshold=0.85, rgb=True, target_pos=0, record_pos=(0.779, 0.382), resolution=(960, 540))): sex = "女" if exists(Template(r"tpl1574924960910.png", threshold=0.89, rgb=True, target_pos=5, record_pos=(0.779, 0.382), resolution=(960, 540))): sex = "男" else: sex = "不存在" namesex = sex keyevent("4") return namesexdef scoll(): try: swipe(v1=(629, 1750),v2=(629, 310)) # 滑动距离需要根据手机分辨率自行调整 except: print("can't go back to the main page")def number(): data_list =[] for i in range(9): # 根据手机分辨率自行调整 try: title =poco(name="com.alipay.mobile.contactsapp:id/contact_item_name")[i].get_text() name = poco(name="com.alipay.mobile.contactsapp:id/concast_from")[i].get_text() print(title) name_a =name[5:6] if title not in data_list and name_a is not "1": poco("com.alipay.mobile.contactsapp:id/contact_item_name")[i].click() sexname=numbe() if sexname =="男": print(str(sexname)) with open(r'./new/男.csv','a',encoding='utf-8') as f:f.write("{},{}\n".format(title,sexname)) else: print(str(sexname)) with open(r'./new/女.csv','a',encoding='utf-8') as f:f.write("{},{}\n".format(title,sexname)) else: print(name_a) print("不存在") except: print("出错,跳过!")a=0while a<5:#根据手机上号码量的多少自行选择 number() scoll() sleep(1) a=a+1
以上是用的是airtest实现的,效率不是很高,同样进行简单改动可以实现支付宝真实号码筛选,效率很高,偶尔使用一下还是可以的,切不可用于非法用途,大家有什么好的方式欢迎留言!
总结
以上所述是小编给大家介绍的Python实现手机号自动判断男女性别,希望对大家有所帮助!
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号