Create a JSON file named invoice.json and write into it the following dictionary: invoice_dict = {* invoice": [{'part_num': 500, 'part_descr': 'hammer', quantity": 10)}. {{part_num": 600, part_descr": "screwdriver', "quantity": 5)}]} Then, read the file with catching exception like FileNotFoundError in a try suite. Display its pretty-printed JSON (p.330).

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 10RQ
icon
Related questions
Question
2.
Create a JSON file named invoice.json and write into it the following dictionary:
invoice_dict = {' invoice":
[{part_num': 500, 'part_descr': 'hammer', 'quantity": 10)},
{'part_num': 600, 'part_descr': "screwdriver', 'quantity': 5)}]}
Then, read the file with catching exception like FileNotFoundError in a try suite.
Display its pretty-printed JSON (p.330).
Transcribed Image Text:2. Create a JSON file named invoice.json and write into it the following dictionary: invoice_dict = {' invoice": [{part_num': 500, 'part_descr': 'hammer', 'quantity": 10)}, {'part_num': 600, 'part_descr': "screwdriver', 'quantity': 5)}]} Then, read the file with catching exception like FileNotFoundError in a try suite. Display its pretty-printed JSON (p.330).
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage