Category : nested-lists

i have the following dictionary dictionary = {‘test1.txt’: {‘apple’: 1, ‘banana’: 1, ‘lemon’: 1}, ‘test2.txt’: {‘apple’: 1, ‘banana’: 1}, ‘test3.txt’: {‘apple’: 1, ‘lemon’: 2}, ‘test4.txt’: {‘apple’: 1, ‘lemon’: 1, ‘grape’: 1}} i want the output to be [[”, ‘apple’, ‘banana’, ‘lemon’, ‘grape’], [‘test1.txt’,1,1,1,0], [‘test2.txt’,1,1,0,0], [‘test3.txt’,1,0,2,0], [‘test4.txt’,1,0,1,1]] The way i am trying is that testcasenumber = ..

Read more

I have nested lists of the form: [‘A’, ‘B’, [‘a0’, ‘a1’, ‘a2’], ‘C’, ‘D’, [‘a0’, ‘a1’, ‘a2’], ‘E’, ‘F’, [‘a0’, ‘a1’, ‘a2’]] and I would like to generate all the combinations with respect to the sublist [‘a0’, ‘a1’, ‘a2’] of the form: [‘A’, ‘B’, [‘a0’], ‘C’, ‘D’, [‘a0’], ‘E’, ‘F’, [‘a0’]] [‘A’, ‘B’, [‘a0’], ‘C’, ..

Read more

i have a route, which has a nested dictionary @app.route("/jin") def jin(): locations = {‘James’: {‘California’:’Yes’, ‘Shanghai’:’No’}, ‘Jack’: {‘California’:’No’, ‘Shanghai’:’No’}, ‘Raven’: {‘California’:’Yes’, ‘Shanghai’:’N/A’}} return render_template("jin.html",locations = locations) i want my table in HTML to look like ———————————– | Person | California | Shanghai | ———————————– |James | Yes | No | ———————————– |Jack | No ..

Read more