Skip to content

dict

The dict function creates a dictionary from a list of key-value pairs. Each odd argument is a key, and the following even argument is the value for that key.

Use cases

Example

dict("a", 1, "b", 2)

… creates a mapping of

  • "a"1
  • "b"2