[PROBLEM]
In a File that refreshes automatically with new data, I want to get: - the number that corresponds to latest string occcurence. For instance, in the dummy example below above I want to fetch: - last occurence of stringZ and afterwards the number inside that text. In practical terms I want to fetch: [99]
File sample:
"....
Manually launch test 1 stringX
Manually launch test 2 stringY
Manually launch test 3 stringW
Manually launch test 10 stringZ
................
Manually launch test 200 stringX
Manually launch test 300 stringY
Manually launch test 77 stringW
Manually launch test 99 stringZ
"
[CODE]
tempFile = open(fileName, "r")
while True:
fileContent = str(tempFile.readlines())
print temp
latestOccurence= re.search("(.*)stringZ",fileContent ).group(0)
latestOccurence= re.search('([0-9])+',latestOccurence).group(0)
print latestOccurence