Python dict() Function
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
dict(keyword arguments)
Parameter Values
Parameter | Description |
---|---|
keyword arguments | Required. As many keyword arguments you like, separated by comma: key = value, key = value ... |