{} (Curly braces)

# Initialize a new dictionary with the given key/value pairs
element_names = {'H': 'hydrogen', 'He': 'helium', 'Li': 'lithium'}

# Curly braces with nothing inside creates an empty dictionary
nothing_here = {}
Description Curly braces are used to define "dictionary literals," giving you the ability to declare a dictionary and its contents inside your program. A dictionary literal consists of a series of key/value pairs, written with a colon (:) between them, and with each of the key/value pairs separated from one other with commas.
	dict = {key0: val0, ..., keyN: valN}
key0: val0, ..., keyN: valNa sequence of key/value pairs
Related [] (Index brackets)
Updated on Sat Dec 1 21:31:10 2018.
Creative Commons License