milad jurablu
milad jurablu

Reputation: 3

How to put dictionary into array

I have a dictionary like this

words = {'key': 'value', 
         'hold on': ['Huummm', 'vaysa alan bhet migam'],
         'Question': ['Hum?', 'Ha?', 'chi?', 'motevajeh nashodam?']

i want to get all value for (hold one) into array like this

word_arraay = ['Huummm', 'vaysa alan bhet migam']

Upvotes: 0

Views: 76

Answers (2)

King
King

Reputation: 174

If you are adding new value to list do append

word_arraay.append(words['hold on'])

If you do not initialize yet the word_arraay use this,

word_arraay = words['hold on']

Hope this helps.

Upvotes: 0

Silveris
Silveris

Reputation: 1186

Just access the list using the right key. In your case:

word_arraay = words['hold on']

Upvotes: 4

Related Questions