From 394834494831017d66f73eb9262cf6f3a5456b5c Mon Sep 17 00:00:00 2001 From: KnugiHK <24708955+KnugiHK@users.noreply.github.com> Date: Mon, 11 Jan 2021 23:31:45 +0800 Subject: [PATCH] Display total bytes of json --- extract.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extract.py b/extract.py index ed7847e..d84c160 100644 --- a/extract.py +++ b/extract.py @@ -105,10 +105,11 @@ for current, i in enumerate(data): f.write(template.render(name=data[i]["name"] if data[i]["name"] is not None else phone_number, msgs=data[i]["messages"].values())) if current % 10 == 0: print(f"Creating HTML...({current}/{total_row_number})", end="\r") -print(f"\nCreating HTML...({total_row_number}/{total_row_number})", end="\r") +print(f"Creating HTML...({total_row_number}/{total_row_number})", end="\r") -print("\nWriting JSON file...") with open("result.json", "w") as f: - f.write(json.dumps(data)) + data = json.dumps(data) + print(f"\nWriting JSON file...({int(len(data)/1024/1024)}MB)") + f.write(data) print("Everything is done!")