import pyautogui #increase volume pyautogui.press('volumeup') #decrease volume pyautogui.press('volumedown')