from pynput.mouse import Button,Controller as mouse_cl from pynput.keyboard import Key,Controller as key_cl import time def send(string): mouse = mouse_cl() mouse.press(Button.left) mouse.release(Button.left) for i in range(10): key = key_cl() key.type(string) key.press(Key.enter) key.release(Key.enter) if __name__ == '__main__':#运行 time.sleep(3) send('爹')