che*_*ile 3 python python-2.7
def test(): print "printing from test func" dic = {'a':1,'b':2,'c':test} if len(dic) == 3: print (dic['c']) output: <function test at 0x106887578>
此代码打印函数对象作为输出,如何从测试函数获取print语句作为输出.
Blu*_*ode 13
只需调用dic['c']()即可运行您的功能.希望我帮忙!
dic['c']()
归档时间:
8 年,8 月 前
查看次数:
3186 次
最近记录: