The goal is to get just the updated numeric values along with their identifiers while ignoring everything else. I have a CDM.txt file with 1 line of information that gets updated every couple hours and the numeric values all change.
'MISS_DISTANCE': '18', 'MESSAGE': 'NEED HELP', 'MISS_DISTANCE': '105398', ETC, ETC
I would like to parse the text file and set the output to variable "Miss Distance". Using that example, I would need to get the following and ignore the rest.
'MISS_DISTANCE': '18' | 'MISS_DISTANCE': '105398'
Here is what I have so far.
with open('CDM.txt') as f:
lines = f.readlines()
reg = re.compile("'MISS_DISTANCE': '.+',")
Not sure what to do from there or if I am even doing the compile correctly. I added the .+ for multiple wildcards since the number can range between 1 to 99999 and a "," at the end because I want it to end there.