would love some help please.
I am trying to write a script to search a JSON file and count the number of occurrences of multiple groups of text.
This is what i have so far. Just trying to count 1 to start with. In the end i would love to be able display the counts in list format. For example, something like this...
Diamond 7 Gold 5 Iron 45
When i run the below script the cmd flashes up and immediately dissappears.
Many thanks!
import json
f = open('_metadata.json')
data = json.load(f)
total_len = len(data)
n = 0
count = 0
while n < total_len:
if data[n]['status'] == "Diamond":
count += 1
if n == total_len-1:
break
n += 1
print("Diamond : %s" % count)
input('Press ENTER to exit')
thanks!