'How do I autopopulate a tkinter table using a loop

I'm trying to auto-populate a tkinter table with the names of folders in a directory and details about their properties

grpdata_name = listdir(r"PATH")
grpdata_path = r"PATH\{}".format(grpdata_name[0])
grpdata_groupcount = -1

for x in grpdata_name :
    grpdata_groupcount = grpdata_groupcount +1
    grpdata_groupcurrent = 'grpdata_name{}{}{}'.format('[',grpdata_groupcount,']')
    GUI_Table.insert(parent='',index='end',iid=0,text='',
    values=('ID',grpdata_groupcurrent,'TIME CREATED','TIME MODIFIED','DEVICES'))

My current method is to change the selected element in a string. This creates a working cycle through each part of the string ( grpdata_name[0] , grpdata_name[1] etc)

I can't figure out how to use the contents of grpdata_groupcurrent as a variable, rather than a string.

This method isn't very efficient overall, so please let me know if there is a better way to do this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source