You can simply store the data in e.g. list
data_list = [data1, data2, data3] for i, data in enumerate(data_list): some_fancy_stuff data_list[i] = data * 2 Some explanation - enumerate will literally enumerate the items of the list with index i and also assigns data_list[i] to variable data. Than you can do whatever you want with data and its index i.