Python dict() Function
❮ Built-in Functions
Example
Create a dictionary containing personal information:
x = dict(name = "John", age = 36, country = "Norway")
Try it
Yourself »
Definition and Usage
The dict()
function creates a dictionary.
A dictionary is a collection which is unordered, changeable and indexed.
Read more about dictionaries in the chapter:
Python Dictionaries.
Syntax
Parameter Values
Parameter |
Description |
keyword arguments |
Optional. As many keyword arguments you like, separated by comma: key
= value, key = value ... |
❮ Built-in Functions