标签:bin print class env color pre code encoding style
把函数作为参数传入,这样的函数称为高阶函数
如下:
1 #!/usr/bin/env python 2 #encoding:utf-8 3 #by i3ekr 4 5 import time 6 def bar(): 7 print "the bar..." 8 9 def func(cs): 10 start_time = time.time() 11 cs() 12 ent_time = time.time() 13 print("the fun run time is %s"%(ent_time - start_time)) 14 15 func(bar)
标签:bin print class env color pre code encoding style
原文地址:https://www.cnblogs.com/nul1/p/8909148.html