反射小例子
作者:互联网
import sys def func(): print('xxx' * 100) def func1(): print('yyy' * 100) l = [('xxx功能', 'func'), ("yyy功能", 'func1')] for ind, f_tup in enumerate(l, 1): print(ind, f_tup[0], f_tup[1]) num = int(input('num : ')) getattr(sys.modules[__name__], l[num - 1][1])()
标签:__,反射,num,tup,yyy,ind,例子,print 来源: https://www.cnblogs.com/a438842265/p/14088442.html