THE WORLD'S LARGEST WEB DEVELOPER SITE

Python dict() Function

❮ Built-in Functions


Example

Create a dictionary containing personal information:

x = dict(name = "John", age = 36, country = "Norway")
Run example »

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 ...

❮ Built-in Functions