Jump to content

Python dict: Difference between revisions

From annawiki
Created page with "<pre> >>> dict(a=1,b=2) {'a': 1, 'b': 2} >>> d=dict(a=1,b=2) >>> d {'a': 1, 'b': 2} >>> **d File "<stdin>", line 1 **d ^ SyntaxError: invalid syntax >>> dict(**d) {..."
 
(No difference)

Latest revision as of 2019-07-28T09:39:36

>>> dict(a=1,b=2)
{'a': 1, 'b': 2}
>>> d=dict(a=1,b=2)
>>> d
{'a': 1, 'b': 2}
>>> **d
  File "<stdin>", line 1
    **d
     ^
SyntaxError: invalid syntax
>>> dict(**d)
{'a': 1, 'b': 2}
>>> dict(**d)==d
True
>>>