H
H
hokim2014-01-13 09:39:54
Python
hokim, 2014-01-13 09:39:54

How to add values ​​to a dictionary?

I have a dictionary:

a = {'google': {'avtor':'larrypage', 'soavtor':'sergeybrin'},
       'company':{'avtor':'somebody', 'soavtor':'somebody'}}

And
name = input("name")
avtor = input("avtor")
soavtor = input("soavtor")

How to add these variables to the dictionary? I wanted to make the format method, but it does not work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2014-01-13
@rhino_o

a.update({name: {'avtor'=avtor, 'soavtor'=soavtor}})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question