Q:

From list create new one list with explicity values from first

I have some api request and as response I got json which I put in list.
That list is :
[
   {
      "status": "running",
      "node": "node-name",
      "uptime": 9484726,
      "name": "hostname",
      "maxcpu": 2,
      ....
      ....
      ....
      ....
   },
   {
      "status": "running",
      "node": "node-name",
      "uptime": 9484726,
      "name": "hostname",
      "maxcpu": 2,
      ....
      ....
      ....
      ....
   },
   {
      "status": "running",
      "node": "node-name",
      "uptime": 9484726,
      "name": "hostname",
      "maxcpu": 2,
      ....
      ....
      ....
      ....

From this list I need to create new one which have only name and vmid, and need looks like:
[
   { 
     "name": "some-name",
     "vmid": "some-vmid"
   },
   { "name": "some-name",
     "vmid": "some-vmid"
   }

How to do this in Python ?

A:

You can do this list comprehension like this,
result = [{'name':i['name'],'vmid':i['vmid']} for i in data]

