the keyboard python module code example
Example 1: Presskeys in python
import pyautogui
# Holds down the alt key
pyautogui.keyDown("alt")
# Presses the tab key once
pyautogui.press("tab")
# Lets go of the alt key
pyautogui.keyUp("alt")
Example 2: python keyboard.write
keyboard.write('The quick brown fox jumps over the lazy dog.')