Home > Software engineering >  Python JSON Parsing first item
Python JSON Parsing first item

Time:10-11

how to list out all the number in front like "1960065840" for all the list. Thank you!

enter image description here

CodePudding user response:

Pass the json string to a dict variable and then cast it into a list.

data = json.loads(json_string)
first_number_list = [data]

This will take all the keys of the dict generated by the json loads method and put them into a list.

CodePudding user response:

I'm not sure what you are trying to do but...

You have to use dictionary_name_here.keys() to get the names of the keys.

Example:

dict = {"key":"value"}
print(dict.keys())

Output:

key
  • Related