Question: Python Could you write these in one single file Task 4: Data Structure It is important to be familiar with the functions of dictionary: items(),

Python

Could you write these in one single filePython Could you write these in one single file Task 4: Data

Task 4: Data Structure It is important to be familiar with the functions of dictionary: items(), keys(), values(), write a program to use all these functions Notes: Dictionary has two ways to initialize data - dict() datal'schoolj = UAlbany, datal'address']- '1400 Washington Ave, Albany, NY 12222' data[Phone'] "(518) 442-3300, data = {'school': 'UAlbany,, 'address: ,1400 Washington Ave, Albany, NY 12222, phone: ,(518) 442-3300'} Print the results as follows by accessing the defined dictionary. school: UAlbany address: 1400 Washington Ave, Albany, NY 12222 phone: (518) 442-3300 Task 5: Data Serialization Use json to store above dictionary in task-5 and then print item, key and values Notes: This task tells how to store a dictionary object to a file and then load the dictionary object from the file. In python, object of any type can be mostly saved in json format to a txt file 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 6: 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,3,4,5] and above dictionary in task-o to a file called 'task6.data', and then load them from the same file and print

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!