本文性别判断主要依靠airtest中的自动化测试实现
通过自动对比支付宝页面男女图像,从而实现男女判断
代码如下:
男女判断函数:
// An highlighted block 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 namesex 手机滑动(根据手机分辨率自行调整): // An highlighted block def scoll(): try: swipe(v1=(629, 1750),v2=(629, 310)) # 滑动距离需要根据手机分辨率自行调整 except: print("can't go back to the main page")
刷选函数:
// An highlighted block 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)) 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 namesex def 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=0 while a<5:#根据手机上号码量的多少自行选择 number() scoll() sleep(1) a=a+1
以上是用的是airtest实现的,效率不是很高,同样进行简单改动可以实现支付宝真实号码筛选,效率很高,偶尔使用一下还是可以的,切不可用于非法用途,大家有什么好的方式欢迎留言!
总结
以上所述是小编给大家介绍的Python实现手机号自动判断男女性别,希望对大家有所帮助!
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
更新日志
2024年09月23日
2024年09月23日
- 华少翌.2005-华少翌【中唱艺能】【WAV+CUE】
- 群星《十二女声Ⅱ》[WAV/CUE/分轨][527MB]
- 大自然音乐系列《漫步在山裡》[WAV/CUE/分轨][502.8MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]
- 史依弘《史依弘交响乐京剧演唱专辑HQ》头版限量编号[WAV+CUE]
- 曼丽2020《女人三十风继续吹》HQCD[WAV+CUE]
- 曼丽2021《女人三十2雾之恋》HQCD[WAV+CUE]
- 隔壁老樊.2019-我曾【好听音乐】【FLAC分轨】
- 高林生.1993-牵挂你的人是我【白天鹅】【WAV+CUE】
- 洪卓立.2012-找个懂我的女孩(国专)【英皇娱乐】【WAV+CUE】
- 曼丽2022《女人三十3晚秋》HQCD[WAV+CUE]
- 曼丽2018《女人三十4冬天》HQCD[WAV+CUE]
- 柏菲-《好歌30年壹》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 大自然音乐系列《水舞》[WAV/CUE/分轨][424.3MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]