12/3/2023 0 Comments Print list of dictionaries pythonIt returned a json like formatted string. We passed the dictionary object and count of indent spaces in json.dumps(). Print(json.dumps(student_score, indent=4)) # Print contents of dict in json like format # A dictionary of student names and their score Then we can print that string, import json In python, json module provides a function json.dumps() to serialize the passed object to a json like string. We can pass the dictionary in json.dumps() to get a string that contains each key-value pair of dictionary in a separate line. Print a dictionary line by line using json.dumps()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |