In a python script, create a list of dictionaries and write JSON from out of the dictionaries.

import json
nameAgeDict = {'Jack': 13, 'Leena':25, 'Martin': 45}
nameCityDict = {'Jack': 'Alley', 'Leena': 'NYC', 'Martin': 'Sydney'}
dictList = [nameAgeDict, nameCityDict]
# using dumps, you can create JSON form any python object
print(json.dumps(dictList))
please upvote. Thanks!
CodeToCopy:
list_of_dicts_json.py
# importing json module
# will be used to convert list of dicts to json
import json
# creating list of dictionaries
list_of_dicts = [{'id': 123, 'data': 'qwerty', 'indices': [1,10]}, {'id': 345, 'data': 'mnbvc', 'indices': [2,11]}]
# printing list of dictionaries
print("List of dictionaries: ");
print(list_of_dicts)
# converting list of dictionaries to json
json_of_list_of_dicts = json.dumps(list_of_dicts)
#printing json string of list of dictionaries
print("Json of list of dictionaries: ");
print(json_of_list_of_dicts)
OutputScreenshot:

In a python script, create a list of dictionaries and write JSON from out of the...
Create a list of dictionaries and write out some JSON from it. It should resemble below once executed: [ { filename: ‘groupproject.txt’, foldername: ‘c:\\class’, size: 345 lastmod: ‘08/11/2015 5:15AM’ }, { filename: ‘homework5.txt’, foldername: ‘c:\\class\\section’, size: 856 lastmod: ‘09/05/2017 8:24PM’ }, and etc.. ]
Exercise 1 - Create a List to Sum Values Write a python script that sums the values in a list called add_list that contains the following values: (10, 2, -4, 8). Make sure you include a for loop when iterating through the list to sum the values. Take screenshots of the code and output. Exercise 2 – Create a Dictionary Write a python script that prints a dictionary where the key numbers are 1, 2, 3, 4, and 5 and...
Write program and programmer information as comments at the top of the script. Create a text file called words.txt and include at least 20 English dictionary-based words in your folder. Program must read the list of words from the file into list data structure. Program chooses a random word from the list and starts asking player to guess the word one character at a time until player wins or runs out of predefined no. of tries. Game continues until the...
write a script which will list the contents of the /dev directory. Then have the script create a file to redirect the output from the file to a new directory called Devsample in the /home directoy which will only display first 10 lines of the directory and last 5 lines of the directory. Show the output of the Devsample file. ( LINUX SCRIPT)
A script in Python 2.7 Create a script that prints the average that continuously updates as new numbers are entered in python. Sample Run Welcome to the Average Calculator, please insert a number New number 1 The current average is 1.0 New number 3 The current average is 2.0 New number 6 The current average is 3.333 New number 6 The current average is 4.0
A. Write a Python script so that the user can enter any number of grades. Create a calcavg() function so that it takes the number of grades as a parameter and returns the regular average (not a weighted average). You must loop through the grades for full credit. Add a try/except block so that if a non-numeric value is entered, you get the error message shown below. You cannot use lists. Input: c. python …\IT2430\FirstLastname\assign5-2.py 96.7 95.6 87.0 d. python...
Write a python program where you create a list (you an create it in code you do not have to use input() statements) that represents the total rainfall for each of 12 months (assume that element 0 is January and element 11 is December). The program should calculate and display the: 1) total rainfall for the year; 2) the average monthly rainfall; 3) the months with the highest and lowest amounts. You need to figure out how to access each...
Solve the code below:
CODE:
"""
Code for handling sessions in our web application
"""
from bottle import request, response
import uuid
import json
import model
import dbschema
COOKIE_NAME = 'session'
def get_or_create_session(db):
"""Get the current sessionid either from a
cookie in the current request or by creating a
new session if none are present.
If a new session is created, a cookie is set in the response.
Returns the session key (string)
"""
def add_to_cart(db, itemid, quantity):
"""Add an...
Python)) Data types of Python. Write the python script to show the different examples. Write the Python script to present ALL the mathematical arithmetic operations. Write the Python script to display your - first name, last name, ID, college name and the program of study. Write the Python script to receive the number of seconds as input and display the hours, minutes and seconds as output. Assume the variable x to be with the string of "Day by day, dear...
Write a few lines in Python that will do the following: Create an empty list Ask the user to enter two numbers Add each number to your list