Skip to content

Commit

Permalink
trying to fix reading from a file
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarer committed Mar 26, 2024
1 parent 88ef194 commit e92ec2f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions _sources/_static/person2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"firstName": "John",
"lastName": "Smith",
"isAlive": true,
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
"phoneNumbers": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "mobile",
"number": "123 456-7890"
}
],
"children": [],
"spouse": null
}
4 changes: 2 additions & 2 deletions _sources/web/writeCode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ and email address.
fh.close()
person_list = json.loads(data)

The file ``person.json`` below contains JSON data for a person in a dictionary including their first name,
The file ``person2.json`` below contains JSON data for a person in a dictionary including their first name,
last name, address, and phone numbers.

.. reveal:: person2_data_rev
Expand Down Expand Up @@ -288,7 +288,7 @@ last name, address, and phone numbers.
.. activecode:: web_email_person_write_v2
:language: python3
:nocodelens:
:datafile: person.json
:datafile: person2.json

Finish the code below so that it prints the first name, last name, the
state the person lives in, and their mobile phone number from the JSON loaded from person2.json.
Expand Down

0 comments on commit e92ec2f

Please sign in to comment.