The python dictionary / dictionary of key / attribute dictionary

1.python dictionary js equivalent in the target

python dictionary keys, use double quotes

example:

dic = {"name":"zs","age":12}

 

Access value 2.python dictionary, use parentheses

dic = {"name":"zs"}
print(dic["name"])  # zs

Add 3.python dictionary property

Using the update () method, add attributes

example:

dic.update("age":12)

 

 

Guess you like

Origin www.cnblogs.com/luguankun/p/11902190.html