Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON 2.7 Notes: Dictionary has two ways to initialize data dict() datal'school']-,SChoo!name, datal'address] = ,1000 School Avenue, Location, State 11111, data['phone'] ='(123) 789-0123, data =
PYTHON 2.7
Notes: Dictionary has two ways to initialize data dict() datal'school']-,SChoo!name, datal'address] = ,1000 School Avenue, Location, State 11111, data['phone'] ='(123) 789-0123, data = { 'school': 'Schoolname', address: , 1000 School Avenue, Location, State 11 111', 'phone','( 123) 789-01231 Print the results as follows by accessing the defined dictionary school: SChoolname phone: (123) 789-0123 Use json to store above dictionary in and then print item, key and values You need to be familiar with the following two json functions: json.dumps(object), which dumps an ob- ject to a json format (string), json.loads(a json format string), which loads a json format string back to the original object. We do not care about if the original object is list, dictionary or others. json.dumps() can automatically recognize Note, json.load (object) only can only load an object, not a file Task: Data Serialization Store a number of different types objects (e.g., list, dictionary, array) to a file and then load the objects from the file Write a function to dump list object items = 1,2,34,5 and above dictionary to a file called task6data, and then load them from the same file and printStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started