I am a newbie to python and i am having issues in having the output of shell command assigned to variable.
I have a python script which runs shell script cmd line and output something like below
Name: test Version: i22349
I want to use this output as input for next operation. How can i assign a variable with the outputted value. Could someone help me with this.
Here is the code which i am using
import os
deploymentName = 'testdeployment'
myCmd = 'list dep ' + deploymentName + ' | egrep "^Version|Deck Name"'
print ("Fetching the Deck details - Running Command - " + myCmd)
os.system(myCmd)
Currently it returns output as ,
Name: test
Version: i22349
How do i get the value test and i22349 assigned to 2 variables inside the python code ?