# -*- coding: utf-8 -*- import time from pyautogui import * def demo1(): time.sleep(2) # 控制键盘发送文本 write('hello world', interval=0.01) print('') time.sleep(1) # 控制单击键的案件 press(['y', 'e', 's', '!'], presses=10, interval=0.001) # 快捷键组合 def demo2(): time.sleep(1) hotkey('ctrl', 'a') hotkey('ctrl', 'c') time.sleep(1) hotkey('ctrl', 'v') # 控制键盘输入中文字符 pip install pyperclip def demo3(): import pyperclip time.sleep(2) pyperclip.copy('写入中文字符') hotkey('ctrl', 'v') demo1() demo2() demo3()
标签:控制,ctrl,import,pyperclip,键盘,sleep,time,hotkey,操作 From: https://www.cnblogs.com/zhaoyiguang/p/16749821.html