funcs = [] for s in ["hello","world"]: func = lambda x: print(s) funcs.append(func) funcs[0](None) funcs[1](None)