2 3 def niming(a,b,func): 4 5 result = func(a,b) 6 return result 7 find = input('请输入一个匿函数:') 8 find = eval(find) #eval 相当与把字符串的引号去掉,使得find输入的匿名函数执 #行 9 10 num = niming(11,12,find) 11 print(num) ~ ~ ~ ~ ~
2 3 def niming(a,b,func): 4 5 result = func(a,b) 6 return result 7 find = input('请输入一个匿函数:') 8 find = eval(find) #eval 相当与把字符串的引号去掉,使得find输入的匿名函数执 #行 9 10 num = niming(11,12,find) 11 print(num) ~ ~ ~ ~ ~
转载于:https://www.cnblogs.com/Smalllv/p/8873539.html