From fbc711210e2abfd08c66c5fa60fb6c5c529228d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 1 Apr 2018 05:06:51 +0200 Subject: [PATCH] Json --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0252ebf..428214f 100644 --- a/README.md +++ b/README.md @@ -444,14 +444,16 @@ import json ### Read File ```python -with open(filename, encoding='utf-8') as file: - return json.load(file) +def read_json_file(filename): + with open(filename, encoding='utf-8') as file: + return json.load(file) ``` ### Write to File ```python -with open(filename, 'w', encoding='utf-8') as file: - json.dump(, file, ensure_ascii=True, indent=None) +def write_to_json_file(filename, an_object): + with open(filename, 'w', encoding='utf-8') as file: + json.dump(an_object, file, ensure_ascii=True, indent=None) ``` SQLite