From e41adc0e9900c53882dc248a7517b9c8986660f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= <sornjure@gmail.com> Date: Sun, 6 Jan 2019 00:12:54 +0100 Subject: [PATCH] Dictionary --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fd6fdfe..b4fff1d 100644 --- a/README.md +++ b/README.md @@ -61,17 +61,17 @@ Dictionary ``` ```python -value = <dict>.get(key, default) # Returns default if key does not exist. -value = <dict>.setdefault(key, default) # Same, but also adds default to dict. -<dict> = collections.defaultdict(<type>) # Creates a dictionary with default value of type. -<dict> = collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1. +value = <dict>.get(key, default) # Returns default if key does not exist. +value = <dict>.setdefault(key, default) # Same, but also adds default to dict. +<dict> = collections.defaultdict(<type>) # Creates a dictionary with default value of type. +<dict> = collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1. ``` ```python <dict>.update(<dict>) -<dict> = dict(<list>) # Initiates a dict from list of key-value pairs. -<dict> = dict(zip(keys, values)) # Initiates a dict from two lists. -<dict> = dict.fromkeys(keys [, value]) # Initiates a dict from list of keys. +<dict> = dict(<list>) # Initiates a dict from list of key-value pairs. +<dict> = dict(zip(keys, values)) # Initiates a dict from two lists. +<dict> = dict.fromkeys(keys [, value]) # Initiates a dict from list of keys. ``` ```python