I have following code below:
def exemplo01():
return 'exemplo01'
def exemplo02():
return 'exemplo02'
def exemplo03():
return 'exemplo03'
def run():
#list of <class 'function'>
fx = []
fx.append(exemplo01)
fx.append(exemplo02)
fx.append(exemplo03)
for item in fx:
print(item())
print('-'*30)
if __name__ == '__main__':
run()
This code works perfectly. But I want to change the run () implementation.
def run():
l = []
for i in range(1, 4):
l.append('exemplo{:0>2}'.format(i))
for i in l:
print(i())
print('-'*30)
In the first implementation the array is of class function, in the second str, I tried to perform a Cast but I did not succeed.