If you are interested only in line
Data : 'uname' is not recognized as an internal or external command, operable program or batch file.
You can use subprocess module to call staf program
import subprocess
output = subprocess.check_output(["staf", "server2.com PROCESS START SHELL COMMAND 'uname' WAIT RETURNSTDOUT STDERRTOSTDOUT"])
and use regular expression. I don't like of regex, but sometimes it is needed.
result = re.findall(r'Data\s+:\s+(.*)', output, re.M)[0]
print result
Edited with information of multline staf program output
output = output.replace('\n', '')
result = re.findall(r'Data\s+:\s+(.*)}', output, re.M)[0]
Edited
o = """{
Return Code: 1
Key : <None>
Files : [
{
Return Code: 0
Data : 'uname' is not recognized as an internal or external command,
operable program or batch file.
}
]
}"""
a = o.replace('\n', '')
import re
print re.findall('Data\s+:\s+(.+?)\}', a)[0].strip()