Dictionary in Python List

Asked 2 weeks ago, Updated 2 weeks ago, 3 views

There is a dictionary in the list, and I want to extract this value only, so can I know how to do it?

abc = [
        "Number one"
        "Number 2"
        "Number 3"
        {"pc" : "i7-10700", "info" : {"price" : "KRW 100000", "year of release" : "2022"} ,
]
abc[3] 
{'pc': 'i7-10700', 'info': {'price': 'KRW 100000', 'year of release': '2022'}}

The value of 'i7-10700' , {'price': 'KRW 100000', 'launch year': '2022'} Is there a way to extract this?

python

2022-09-20 11:14

2 Answers

abc[3].values()


2022-09-20 11:14

abc[3].keys()

['pc', 'info']

abc[3].values()

['i7-10700', {'Price': 100000 won', 'Released year': 2022'}]

abc[3]['info'].values()

["100,000 won", 2022]


2022-09-20 11:14

If you have any answers or tips


© 2022 pinfo. All rights reserved.