-2

How do we write a script in python such that it opens a new terminal, executes commands in that terminal(entered in runtime) and saves it to a variable in the python script ?

A solution to my issue as I am unsure how to proceed

Shanaya
  • 7
  • 7
  • Why does it need to open a terminal? Why can't the Python script run the commands terminal/shell commands directly ([see related Q&A](https://stackoverflow.com/q/89228/2745495))? What does "entered in runtime" mean? What do you mean by "save to a variable"? If you let the Python script run the terminal/shell commands directly, you can also get the output within the same script ([see related Q&A](https://stackoverflow.com/q/4760215/2745495)). – Gino Mempin Aug 29 '23 at 09:32
  • I understand, let's say we don't know the commands before executing the python script and know it when we are in terminal. Execute in terminal and get saved to a python variable, say a dictionary. I don't want python commands to be run directly. – Shanaya Aug 29 '23 at 09:51

0 Answers0