函数作为数据类型

 1 # 1、函数可以作为一种数据类型   function
 2 # 2、函数的返回值可以作为一种数据类型
 3 
 4 def func1():
 5     return "abc"
 6 
 7 a = func1
 8 print(type(a))   # function
 9 print(type(func1))   # function
10 
11 b = func1()
12 print(type(b))  # str

 

posted @ 2019-07-29 19:44  巨菜的小鸟  阅读(151)  评论(0编辑  收藏  举报