Python fetches the key and the corresponding value of the dictionary in the list

has a list as follows

related codes

[
  {
    "id": 1,
    "title": "test",
    "content": "hello world    ",
    "author": "akirayu",
    "create_time": 1490161295
  },
  {
    "id": 2,
    "title": "testforgood ",
    "content": "you are not hired for skills you are hired for your motivate    ",
    "author": "akirayu102",
    "create_time": 1490161714
  }
]

I want to take key as "content" value as "you are not hired for skills you are hired for your motivate"

how can I get it through python? Thank you.

Jun.18,2021

list is assigned to the variable data. Use data [1] ['content'] to get what you want.


import json

s="""
[
  {
    "id": 1,
    "title": "test",
    "content": "hello world    ",
    "author": "akirayu",
    "create_time": 1490161295
  },
  {
    "id": 2,
    "title": "testforgood ",
    "content": "you are not hired for skills you are hired for your motivate    ",
    "author": "akirayu102",
    "create_time": 1490161714
  }
]
"""

js = json.loads(s)

print(js[1]["content"])
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31716-2bd99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31716-2bd99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?