Creating Dictionaries


/ Published in: Python
Save to your folder(s)

Any keyword arguments you pass to the dict constructor are added to the newly created dictionary before returning. Of course, you are limited to the keys that can be made into keyword arguments: valid Python variable names.


Copy this code and paste it in your HTML
  1. dict(a=1, b=2, c=3)
  2. returns {'a': 1, 'b': 2, 'c': 3}

Report this snippet


Comments


You need to login to view comments.