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>
这段代码将函数对象作为输出打印出来,如何将test函数的print语句作为输出获取。
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>
这段代码将函数对象作为输出打印出来,如何将test函数的print语句作为输出获取。
f()
- juanpa.arrivillaga