From 78c0fc9ee532c6d67a6b7d645b4e6945920911f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 26 Mar 2018 16:37:04 +0200 Subject: [PATCH] Little corrections --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6c9a47d..ab7fd55 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,10 @@ re.search(, text) >>> person = {'name': 'Jean-Luc', 'height': 187.1} >>> '{p[height]:.0f}'.format(p=person) '187' +``` + +#### Or: +```python >>> f"{person['height']:.0f}" '187' ``` @@ -434,9 +438,7 @@ with open(filename, encoding='utf-8') as file: ### Write to File ```python with open(filename, 'w', encoding='utf-8') as file: - json.dump(, file) - # Or - file.write(json.dumps()) + json.dump(, file) # Or: file.write(json.dumps()) ``` SQLite