i have some data (ID = Name), and i want to put the names of the given people IDs in a QTableWidget, but i’m having problems with a for loop…
here’s my code:
for x in people:
for y in range(len(people)):
view.setItem(y, 0, QtGui.QTableWidgetItem(name[x][:-1][1:]))
where y in view.setItem(y, 0, QtGui.QTableWidgetItem(name[x][:-1][1:])) is the row index on table, i want to make a table with the names of the given IDs.
this is the result with 3 IDs given:
| Jhon |
| Jhon |
| Jhon |
and this is what i’d like it to display:
| Sally |
| kate |
| Jhon |
any help?
I think you want
enumeratehere.