I am retrieving data by reading multi line python string.
My string is shown below:
Hostname: windos
Model: OS_5000
OS: 18.2
OS Kernel 64-bit [2020_Stable]
....
.....
....
I am looking to extract Model value i.e. 5000 from this string. Not sure how to do it.
dpath = op.response()
dpath = dpath[dpath.find("Model:")+ 6 : dpath[dpath.find("Model:")+ 11]
Also, model string could be of variable length. Is there any better way of doing it?
EDIT: Model value could be numeric or non-numeric.
"\n") after that position (str.find()takes an optional second parameter to specify the starting position to search). Use that position as the end of your slice.