#import modulesfrom pynput.keyboard import *import timeimport pyautogui#Ask user for ID and PassID = int(input('Enter ID: '))Pass = int(input('Enter Pass: '))#Enable controllerk = Controller()#Press and Release 'win.key'k.press(Key.cmd)k.release(Key.cmd)time.sleep(1)#Typing "zoom" with a tim.sleeptime.sleep(0.1)k.press('z')k.release('z')time.sleep(0.1)k.press('o')k.release('o')time.sleep(0.1)k.press('o')k.release('o')time.sleep(0.1)k.press('m')k.release('m')time.sleep(0.1)#Execute enter keyk.press(Key.enter)k.release(Key.enter)time.sleep(2)#Postion for mouse clickx=501y=291#Move mouse to positionpyautogui.moveTo(x, y, duration = 2)#Click on the positionpyautogui.click()#Enter Zoom credentialsk.type(ID)k.type(Pass)最后 2 行抛出错误:Traceback (most recent call last): File "C:/Users/rijul/Desktop/PyCharm Projects/learningclass.py", line 50, in k.type(ID) File "C:\ Users\rijul\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pynput\keyboard_base.py", line 461, in type for i, character in enumerate(string): TypeError: 'int' 对象不可迭代PS 你需要安装 zoom 才能工作......
3 回答
人到中年有点甜
TA贡献1895条经验 获得超7个赞
ID = int(input('Enter ID: ')) Pass = int(input('Enter Pass: '))
变量将输入作为integers
但k.type
需要的字符串。
解决这个问题的一种方法是使它成为一个字符串 -str(ID)
忽然笑
TA贡献1806条经验 获得超5个赞
我认为您传递了错误的参数,因为 k.type 正在寻找string
价值,而您传递的是integer
. 简而言之,您应该用ID
andPass
作为 astring
代替integer
.
ID = input('Enter ID: ') Pass = input('Enter Pass: ')
添加回答
举报
0/150
提交
取消