made print_memories_if() function

This commit is contained in:
lmluk
2024-09-03 13:59:23 +02:00
parent 47c179192a
commit 475ed54b6a

20
main.py Normal file
View File

@@ -0,0 +1,20 @@
import json
def print_memories_info(data):
n = 0
for i in data:
print("\nBeReal Nr. %s: " % n)
f_image = i['frontImage']
b_image = i['backImage']
print(" - Time Taken: %s\n - Front Image: %s\n - Back Image: %s\n - Location: %s"
% (i['takenTime'],
f_image['path'].split("/")[-1], b_image['path'].split("/")[-1],
i['location'] if 'location' in i else 'N/A'))
n+=1
if __name__ == '__main__':
f = open('memories.json')
print_memories_info(json.load(f))
f.close()