summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarcel Ribeiro Dantas <ribeirodantasdm@gmail.com>2022-12-01 19:29:50 -0300
committerGitHub <noreply@github.com>2022-12-01 19:29:50 -0300
commit4d6309b2bde3c927691b15d049ef7a31c678e1f1 (patch)
tree105ca865fc6a8d1c08a471592ef3e9bfd2b52951
parent7b623a7998b7b8aa6f428d678067cbaaad4b2790 (diff)
Add missing json import
-rw-r--r--python.html.markdown1
1 files changed, 1 insertions, 0 deletions
diff --git a/python.html.markdown b/python.html.markdown
index 2247f263..175f17ec 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -503,6 +503,7 @@ contents = {"aa": 12, "bb": 21}
with open("myfile1.txt", "w+") as file:
file.write(str(contents)) # writes a string to a file
+import json
with open("myfile2.txt", "w+") as file:
file.write(json.dumps(contents)) # writes an object to a file