xxxxxxxxxx
# pip install pynput
from pynput.keyboard import Key, Controller
# Create a Controller object
keyboard = Controller()
# Simulate pressing the 'a' key
keyboard.press('a')
keyboard.release('a')
# Simulate pressing the 'enter' key
keyboard.press(Key.enter)
keyboard.release(Key.enter)
xxxxxxxxxx
# in command prompt, type "pip install pynput" to install pynput.
from pynput.keyboard import Key, Controller
keyboard = Controller()
key = "a"
keyboard.press(key)
keyboard.release(key)