From b82cd724cf9c3fd67b65008b015e0d6eda80d5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 27 Feb 2019 16:29:00 +0100 Subject: [PATCH] Dictionary --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4db6f35..3909388 100644 --- a/README.md +++ b/README.md @@ -63,17 +63,17 @@ Dictionary ``` ```python -value = .get(key, default=None) # Returns default if key does not exist. -value = .setdefault(key, default=None) # Same, but also adds default to dict. - = collections.defaultdict() # Creates a dictionary with default value of type. - = collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1. +value = .get(key, default=None) # Returns default if key does not exist. +value = .setdefault(key, default=None) # Same, but also adds default to dict. + = collections.defaultdict() # Creates a dictionary with default value of type. + = collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1. ``` ```python -.update() # Or: dict_a = {**dict_a, **dict_b}. - = dict() # Initiates a dict from coll. of key-value pairs. - = dict(zip(keys, values)) # Initiates a dict from two collections. - = dict.fromkeys(keys [, value]) # Initiates a dict from collection of keys. +.update() # Or: dict_a = {**dict_a, **dict_b}. + = dict() # Initiates a dict from coll. of key-value pairs. + = dict(zip(keys, values)) # Initiates a dict from two collections. + = dict.fromkeys(keys [, value]) # Initiates a dict from collection of keys. ``` ```python