怎么用Python批量验证和添加手机号码为企业微信联系人
发表于:2024-10-28 作者:千家信息网编辑
千家信息网最后更新 2024年10月28日,这篇文章主要讲解了"怎么用Python批量验证和添加手机号码为企业微信联系人",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"怎么用Python批量验证和
千家信息网最后更新 2024年10月28日怎么用Python批量验证和添加手机号码为企业微信联系人
这篇文章主要讲解了"怎么用Python批量验证和添加手机号码为企业微信联系人",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"怎么用Python批量验证和添加手机号码为企业微信联系人"吧!
目录
需求
源码
运行
需求
批量验证和添加手机号码为企业微信账号的联系人
源码
import tkinter as tkimport pyautogui as pgimport tkinter.messagebox as msgbox def setpos(): global x,y try: x,y = eval(tEntry.get()) except: pass pg.click(x-150,y) pg.typewrite('1') pg.moveTo(x,y,duration=0.5) def alter(num): tList.delete(index) tList.insert(index,phone+','+str(num)) user[index] = phone+','+str(num) with open("phones.txt","w",encoding="utf-8") as f: f.write('\n'.join(user)) def flag0(): alter(0) def flag1(): alter(1) def flag2(): alter(2) def start(): global x,y,index,phone x0,y0 = pg.position() lines = len(user) index = -1 for i in user: index += 1 if len(i)==11:break phone = user[index] if len(phone)>11: msgbox.showinfo('提示','手机号大于11位,或全部结束!') else: try: t = tList.curselection()[0] tList.select_clear(t,t) except: pass tList.select_set(index,index) pg.click(x-150,y) pg.typewrite('\b'*50) pg.typewrite(phone) pg.moveTo(x,y,duration=0.5) pg.click() pg.moveTo(x0,y0) def main(): '''written by hannyang 2021.10.16''' global tEntry,tList global user root = tk.Tk() root.geometry(f'375x323+{x+55}+{y-85}') root.resizable(False, False) root.title('《企业微信好友》') root.wm_attributes('-topmost',True) tEntry = tk.Entry(root,width=8) tEntry.place(x = 275, y = 270) tEntry.insert(0,'995,410') bt1 = tk.Button(root,text=' 定位 ',command = setpos) bt1.place(x = 220, y = 265) bt2 = tk.Button(root,text=' 开始 ',command = start) bt2.place(x = 30, y = 265) bt3 = tk.Button(root,text=' 标0 ',command = flag0) bt3.place(x = 80, y = 265) bt4 = tk.Button(root,text=' 标1 ',command = flag1) bt4.place(x = 125, y = 265) bt5 = tk.Button(root,text=' 标2 ',command = flag2) bt5.place(x = 170, y = 265) user = [] try: with open('phones.txt', 'r', encoding='utf-8') as fn: users = fn.readlines() for usr in users: if usr[-1]=='\n': usr=usr[:-1] user.append(usr.strip()) except: user = ['当前文件夹中phones.txt文件不存在!'] tScroll=tk.Scrollbar(root, orient=tk.VERTICAL) tScroll.place(x=330,y=25,height=220) tList=tk.Listbox(root,selectmode=tk.BROWSE,yscrollcommand=tScroll.set) tList.place(x=30,y=25,width=300,height=220) for i in user: tList.insert(tk.END,i) tScroll.config(command=tList.yview) tList.select_set(0,0) root.update() tmp = list(set(user)) diff = len(user)-len(tmp) if diff!=0: msgbox.showinfo('提示',f'存在{diff}个重复手机号!可忽略') root.mainloop() if __name__ == '__main__': x,y = pg.size() x = (x - 390)//2 + 350 y = (y - 360)//2 + 65 main()
注:代码倒数两三行中,390,360是被点窗口的大小,350,65用于定位坐标。
以下是保存电话的文本文件 phones.txt 的内容,手机号码已隐去:
运行
程序没有设置全自动的验证和添加,如果需要的话,则要把相关的按钮截图保存好.jpg图片,然后使用 pyautogui.locateCenterOnScreen() 等函数来定位,加上循环语句就能达成。
感谢各位的阅读,以上就是"怎么用Python批量验证和添加手机号码为企业微信联系人"的内容了,经过本文的学习后,相信大家对怎么用Python批量验证和添加手机号码为企业微信联系人这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!
手机
验证
企业
号码
手机号码
联系
内容
文件
学习
定位
手机号
源码
需求
提示
运行
代码
全自动
函数
图片
坐标
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
管理服务器连接不上去
网络安全检测的设备
江阴戴尔服务器维修多少钱
怎样提取数据库数据
1.8天空巨人服务器
校园网络安全教育的活动背景
网宿科技 工业互联网
软件开发私活难沟通
江苏宿迁网络安全教育
怎么打开数据库文件
酒店软件开发三方协议范本
数据库事务日志哪里看
软件开发服务资质认证三级办理
运城网络技术怎么样
数据库语法的运行优先级
b s的数据库应用
rad软件开发模式
江西服务器维修调试云主机
信息工程及计算机网络技术简介
app软件开发咨询
软件开发私活 从哪里来
软件开发人才外包公司
sql服务器角色
肇庆应用软件开发联系方式
合肥专业警察网络安全管理
巴中市网络安全教育专题讲座
网络安全工程收入
浙江邮件营销外贸软件开发公司
app软件开发咨询
数据库日志可以发给别人吗