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 | Optional. As many keyword arguments you like, separated by comma: key = value, key = value ... |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.