var = [var1, var2, var3, ('a3', 'b4', 'c5'), var5]
You can also copy var i in a loop, but this is a very bad programming practice. Basically, you should create a list up and not later from the variable names. If you have to do this, here's how:
var = [locals()['var' + str(i)] for i in range(6)]
This is a longer form:
var = []
for i in range(6):
var.append(locals()['var' + str(i)])
source
share