Count The Length Of List
How can I count the length of list. I have following file [0 1 2] [0 1 2] [0] [0 1 2] [0 1 2] [0] In above example the first list should print 3 and so on
Solution 1:
Assuming your entire JSON string is in proper format (e.g. I didn't check it all since it's pretty long) you can load it like this:
import json
json_data=open('json_data')
data = json.load(json_data)
print(data)
json_data.close()
And then to reference different parts of the JSON like so:
data["resouceId"]
data["properties"]["title"]
# etc...
Edit
If you want to get all the resourceId
then you can try something like:
forkey, value in data.items():
ifkey == "resourceId":
print(value)
Post a Comment for "Count The Length Of List"