Home > other >  Python list parsing
Python list parsing

Time:10-20

Ids=[{" instance_id ":" addfdljfldjfldjlfdj ", "port" : "3306"}, {" instance_id ":" addfdljfldjfldfdfdaaaaaa ", "port" : "3307"}]

Ask how to remove instance_id value under this

CodePudding user response:


A=[value for I in range (len (ids)) for the key, the value of ids in [I] the items () if the key=="instance_id"]

A line with

CodePudding user response:

 & gt;> Ids [0] [" instance_id "] 
'addfdljfldjfldjlfdj'
> Ids [1] [" instance_id "]
'addfdljfldjfldfdfdaaaaaa
  • Related