1
2
3
4
5
6
7
8
9
10
11
12
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to Trinket.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11
0
0
0
0
In this chapter you're learning to save a list to a ____ file. (All uppercase characters) | JSON | ^ *JSON *$ | |
Before you work with JSON files, you must _______ the module. | import | ^ *import *$ | |
Import the module that lets you work with JSON files. | import json | import `json | |
Open students.json for writing. The file handle is j. | with open("students.json", "w") as j: | with open("students.json", "w") as j: | |
Open a JSON file for writing. Make everything up. | with open("students.json", "w") as j: | ^ *with open\(•.+\.json•, •w•\) as [a-zA-Z_][a-zA-Z0-9_]*: *$ | |
You're writing the list named stuff to the JSON file that you've opened with the file handle j_file. Fill in the blank. | json.dump(stuff, ______) | j_file | ^ *j_file *$ |
You're writing the list named stuff to the JSON file that you've opened with the file handle j_file. Fill in the blank. | json.dump(_________________) | stuff, j_file | ^ *stuff, j_file *$ |
You're writing the list named stuff to the JSON file that you've opened with the file handle j_file. Fill in the blank. | ____________(stuff, jfile) | json.dump | ^ *json\.dump *$ |
Code the line that writes a list to a JSON file. Make everything up. Start by indenting. | json.dump(big_list, json_file) | ^ * json\.dump\([a-zA-Z_][a-zA-Z0-9_]*, [a-zA-Z_][a-zA-Z0-9_]*\) *$ | |
Open a JSON file for writing and write a file to it. Make everything up. | with open("cats.json", "w") as j_file: json.dump(some_list, j_file) |
^ *with open\(•.+\.json•, •w•\) as ([a-zA-Z_][a-zA-Z0-9_]*):\n json\.dump\([a-zA-Z_][a-zA-Z0-9_]*, \1\) *$ | |
|
|||