Can a Python script enter commands on the command line -




i have executable script, let's call script.py. trying run series of commands within terminal starting

python3 ./differentscript.py console 

which allow me type in additional commands.

however, wondering if can automated i.e. have script somehow output , execute commands?

edit: took @ links commented below; can provide example of like?

@chen xie

if want call few commands @ once, can call below:

subprocess.popen('echo first&echo second&echo third', stdout=subprocess.pipe, shell=true).stdout.read() 

it's not pythonic solution, works.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -