一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

腳本之家,腳本語言編程技術及教程分享平臺!
分類導航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務器之家 - 腳本之家 - Python - Python 批量驗證和添加手機號碼為企業(yè)微信聯(lián)系人

Python 批量驗證和添加手機號碼為企業(yè)微信聯(lián)系人

2022-01-28 22:13Hann Yang Python

你是否也有過需要添加很多微信好友的時候,一個個輸入添加太麻煩了,本篇文章手把手教你用Python替我們完成這繁瑣的操作,大家可以在過程中查缺補漏,看看自己掌握程度怎么樣

需求

批量驗證和添加手機號碼為企業(yè)微信賬號的聯(lián)系人

Python 批量驗證和添加手機號碼為企業(yè)微信聯(lián)系人

 

源碼

import tkinter as tk
import pyautogui as pg
import 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('《企業(yè)微信好友》')
  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 的內容,手機號碼已隱去:

Python 批量驗證和添加手機號碼為企業(yè)微信聯(lián)系人

 

運行

Python 批量驗證和添加手機號碼為企業(yè)微信聯(lián)系人

程序沒有設置全自動的驗證和添加,如果需要的話,則要把相關的按鈕截圖保存好.jpg圖片,然后使用 pyautogui.locateCenterOnScreen() 等函數來定位,加上循環(huán)語句就能達成。

到此這篇關于Python 批量驗證和添加手機號碼為企業(yè)微信聯(lián)系人的文章就介紹到這了,更多相關Python 批量驗證企業(yè)微信內容請搜索服務器之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持服務器之家!

原文鏈接:https://blog.csdn.net/boysoft2002/article/details/120802563

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产福利视频一区二区微拍视频 | 美女草b| 久久黄色精品视频 | 无码欧美喷潮福利XXXX | 日本精品久久久久中文字幕 1 | 亚洲欧美日韩中文字幕久久 | 日本精品一卡二卡≡卡四卡 | a韩剧| 成人免费毛片一区二区三区 | 四虎最新永久在线精品免费 | bt天堂午夜国产精品 | 久草在线福利资站免费视频 | 国产免费色视频 | chinesefree普通对话 | 公翁的舌尖研磨她的花蒂小说 | 亚洲香蕉综合在人在线视看 | 91在线视频免费观看 | 五月天网站 | 成年人在线免费观看视频网站 | 天天快乐在线观看 | 天天爽天天操 | 日韩黄色影视 | 大桥未久一区二区 | 俄罗斯freeoo性另类 | 国产成人久久 | 欧美一级欧美三级在线 | 国产短视频精品一区二区三区 | 好大好爽好硬 | 秋霞午夜伦午夜高清福利片 | 亚洲骚图| 亚洲AV久久无码精品九号软件 | 色悠久久久久综合欧美99 | 好紧好爽再叫浪一点点潘金莲 | 果冻传媒在线播放观看w | 婷婷激情综合五月天 | 国产精品成| 国产99页 | 国产精品欧美亚洲韩国日本 | 久久国产精品无码视欧美 | 日本在线视频网 | 岛国免费大片 |