How to display 3 lists together using Python 3 + django2?

Tiếu Thủy Source

I have a list as follow:

item1, [subitems] 
item2, [subitems]
 ... 
itemN, [subitems]

For instance, item1 .. itemN might be a list of classes, and [subitems] contains a list of students that attend each class. A student might attend more than 1 class.

Each class and student has a description (in a string variable).

I want to create a (static) table that contains two columns. The first column is the list of classes.

When I click to one element in the first column, the second column will display the list of students attend this class. Also, the description of the class will be displayed.

If I click to a student, the cell will expand and display the description of the student.

Sorry if the description is not so clear. The idea is as the image following:

The list and description are stored in TXT files, not database.

enter image description here

pythondjangopython-3.x

Answers

answered 6 months ago Diksha Jiwane #1

Your question is not very clear, but i will suggest you to read list comprehension and chain itertools. https://docs.python.org/3/tutorial/datastructures.html#list-comprehension

https://docs.python.org/2/library/itertools.html#itertools.chain

I didn't understand your question exactly. But if you have a list like my_list = [[[1,2], [2,3]], [[1,2], [2,3]]]. You can manipulate this with list comprehension and chain(itertool).

comments powered by Disqus