Skip to content Skip to sidebar Skip to footer

How To Use Python To Start An Interactive Shell Program?

I have used python subprocess and os module for a while. Now I want to start an interactive C++ program called dumbCalculator from python. This dumbCalculator simply read my input

Solution 1:

Either of these two commands will run an interactive program for you and return to Python when the program ends. They will not necessarily return a value from that program. 'bc' is an interactive calculator for testing. It will let you add numbers and then return to Python when you type 'quit'.

>>> os.system("bc")

>>> subprocess.call("bc")

Post a Comment for "How To Use Python To Start An Interactive Shell Program?"