Skip to content

Commit dbf92b6

Browse files
committed
✏️ Use context manager
1 parent a38f593 commit dbf92b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/data-processing/serialisation-formats/json/example.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
"import json\n",
3434
"\n",
3535
"\n",
36-
"f = open(\"books.json\")\n",
37-
"data = json.load(f)\n",
36+
"with open(\"books.json\") as f:\n",
37+
" data = json.load(f)\n",
3838
"\n",
39-
"for i in data:\n",
40-
" print(i)"
39+
" for i in data:\n",
40+
" print(i)"
4141
]
4242
},
4343
{

0 commit comments

Comments
 (0)