open() — and the with-block AI keeps forgetting — step 9 of 9
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Last drill — the JSON pattern AI uses on every config file.
- Import
json. - Write a dict
{"app": "promptdojo", "users": 1}to/tmp/config.jsonusingjson.dump(data, f)inside awithblock. - Read it back with
json.load(f). - Print the value of the
"app"key.
Expected output:
promptdojo
⌘↵ runs the editor.read, then continue.
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Last drill — the JSON pattern AI uses on every config file.
- Import
json. - Write a dict
{"app": "promptdojo", "users": 1}to/tmp/config.jsonusingjson.dump(data, f)inside awithblock. - Read it back with
json.load(f). - Print the value of the
"app"key.
Expected output:
promptdojo
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.