#当按键q的时候,自动输入 “大家好!”并回车键发送!
from pynput import keyboard
from pynput.keyboard import Key, Controller kb = Controller() def on_release(key):
try:
if key.char == "q":
kb.type(u'大家好!!!')
kb.press(Key.enter)
kb.release(Key.enter) except:
pass while True:
with keyboard.Listener(
on_release = on_release) as listener:
listener.join()