I am using Circuitpython for my microcontroller. I am writing whatever my microcontroller do when internet is gone to text file like this:
[{'name': 'exampleA', 'time': '2022-03-15 15:12:55.12541', 'id': '5456431', 'howmany': 2, 'character':None}]
exampleA can repeat in this text file, I always need to check last exampleA's values. So I wrote this;
string = exampleA # it will be taken from user.
file = open("example.txt")
for line in reversed(file.readlines()):
if string in line:
print(len(file.read()))
print(string)
When I found exampleA
, how can I take exampleA
's time too? Because for example if microcontroller do something with exampleA
, it shouldn't do things for at least 3 hour. So I need to take last exampleA
's time.