Python dict() Function

Example

Create a dictionary containing personal information:

x = dict(name = "Bill", age = 63, country = "USA")

Run Example

Definition and Usage

The dict() function creates a dictionary.

Dictionaries are unordered, mutable, and indexed collections.

Learn more about dictionaries in this chapter: Python Dictionary.

Syntax

dict(keyword arguments)

Parameter Value

Parameter Description
keyword arguments Required. Any number of keyword arguments, separated by commas: key = value, key = value ...