To allow users to select one column from the QTreeWidget as below. (If you’d like to know how to generate tree widget, check “How to use QTreeWidget() in PySide2” first.)
Though the following is one of the ways to access items of multiple list, an error “index out of range” will occur when the lengths of the lists are different. How can I solve it?
list1 = ["A", "B", "C", "D"]
list2 = [1, 2, 3, 4]
list3 = ["Apple", "Orange", "Banana", "Peach"]
for i in range(len(list1)):
print(list1[i], list2[i], list3[i])
The output is as below.
A 1 Apple
B 2 Orange
C 3 Banana
D 4 Peach
GOAL
To access each n-th item of multiple lists in one for loop.