Python Dictionary Search Question

Asked 6 days ago, Updated 6 days ago, 1 views

a['321'] = {'a' : '123', 'b' : '456'}
a['789'] = {'a' : '987', 'b' : '654'}

When using multiple dictionaries directly without loading files in this way

Search 321 using infinite loops and for statements

First: 123

Second: 456

If you want to answer that, how do you code?

It's my first time studying dictionaries, so it's really hard I ask for your help me.

python dictionary search

2022-09-20 14:55

1 Answers

for i in a['321']:
    print(a['321'][i])


2022-09-20 14:55

If you have any answers or tips


© 2022 pinfo. All rights reserved.