I'm trying to retrieve variables from a text file and pass those variables into python. Also in one text file i will have an content such as :
Total Numbers: 22, Total Boxes: 33, Total Tickets: 62, Total Files: 107
Total Numbers: 2, Total Boxes: 53, Total Tickets: 92, Total Files: 105
Total Numbers: 3, Total Boxes: 13, Total Tickets: 22, Total Files: 137
Total Numbers: 42, Total Boxes: 38, Total Tickets: 62, Total Files: 143
How can I only retrieve variables from the last line, for example i want to be able to pass Total Numbers: 42
, then separately pass Total Boxes: 38
, etc etc.
For example lets say i have a function in python
def get_content():
f = open('test.txt')
#not sure how to only retrieve last line
my_number = # this is where i want to pass Total_numbers to get a value of 42
f.close()