Python Dictionary Search Question

Asked 2 years ago, Updated 2 years ago, 81 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


© 2024 OneMinuteCode. All rights reserved.