I am iterating through a list and want to use the list item to call a function. This is what I have tried:
def get_list1():
....do something
def get_list2():
....do something
def get_list3():
....do something
data = ['list1', 'list2', 'list3']
for list_item in data:
function_call = 'get_' + list_item
function_call()
But I am receiving the error "TypeError: 'str' object is not callable" There are a couple of other ways that I could attack this, but this would be helpful to know for the future as well. Thanks!