Sending Arrow Keys to Popen

前端 未结 2 642
臣服心动
臣服心动 2021-01-05 17:29

I know that it\'s possible to send printable input to subprocesses by writeing to their stdin

from subprocess import,          


        
2条回答
  •  [愿得一人]
    2021-01-05 17:57

    Try pyautogui library. For example:

    pyautogui.hotkey('ctrl', 'c')  # ctrl-c to copy
    pyautogui.press('enter')  # press the Enter key
    

    More examples in the library webpage. For me it worked - see here.

提交回复
热议问题