In the previous program, we called an external program and it printed its output directly to the user's shell. This time, we are calling the same program, but everything that it printed is captured by us and saved in a variable.
Use the "subprocess" module and its "getoutput" function, which takes a command line to be executed via shell and returns the output as text.
Later you can use the output as you want it in your program. The call of "date" will not interfere with what you are printing from the Python script.
Here is one of the simplest ways to execute an external program from your Python script. Use the "os" (stands for "operating system") module, and call its "os.system" function, which takes a command line that will be executed.
Please notice that while you see the output of the "date" program, Python actually did not print it. The program "date" itself printed it.