From 69eedbb1241c6d4678292189551b337020949698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 9 Apr 2018 18:38:46 +0200 Subject: [PATCH] Dict filter fixed --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd5f35f..9146592 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Dictionary ```python collections.defaultdict() # Creates a dictionary with default values. dict(zip(keys, values)) # Initiates a dict from two lists. -{k: v for k, v in .iteritems() if k in } # Filters a dict by keys. +{k: v for k, v in .items() if k in } # Filters a dict by keys. ``` ### Counter @@ -138,7 +138,7 @@ type() # / / ... ``` ```python import numbers -isinstance(, numbers.Number) +isinstance(, numbers.Number) # numbers.Integral, numbers.Real ``` @@ -404,10 +404,19 @@ def read_file(filename): ### Write to File ```python def write_to_file(filename, text): - with open(filename, 'w', enconding='utf-8') as file: + with open(filename, 'w', encoding='utf-8') as file: file.write(text) ``` +### Path +```python +imort os +os.path.exists() +os.path.isfile() +os.path.isdir() +os.listdir() +``` + ### Execute Command ```python import os