0
我想運行一些打開另一個shell的命令,我可以輸入特定的命令。在那個shell中,我想在循環中運行另一個命令。 更具體的 - 在我的例子,它看起來像這樣:如何從python中的另一個shell執行命令?
> openssl s_client -connect 10.10.10.10:10000 ### this is the first command
CONNECTED(00000003) ### some output
(...)
### now i'd like to type 'R' in a loop (R means renegotiate)
什麼是做到這一點的最好方法是什麼?在此先感謝您的幫助
我認爲你正在尋找子https://docs.python.org/2/library/subprocess.html – ginginsha