python 实现模拟键盘输入

import time
from pynput.keyboard import Key,Controller
keyboard  = Controller()
a = input("请输入你要循环的内容:")
b = int(input("请输入循环的次数:"))
print("数据以接收!请将光标移动到对话框")
time.sleep(2)
for i in range(3):
    print(r"距离程序运行还有%d秒"%(3-i))
    time.sleep(0.01)

for i in range(b):
    keyboard.type(a)
    keyboard.press(Key.enter)

    keyboard.release(Key.enter)
    time.sleep(0.8)
print("消息发送成功!请关闭窗口")

你可能感兴趣的:(python,python)