首页 > 编程语言 > 详细

Python dict 存放函数

时间:2019-05-09 12:05:20      阅读:143      评论:0      收藏:0      [点我收藏+]
  • Python 字典,可以直接存放函数,并执行正常。

#!/usr/bin/python3

dict1 = dict()


def test_fun():
    print("test dict")


dict1["func"] = test_fun


dict1["func"]()

Python dict 存放函数

原文:https://www.cnblogs.com/chenfulin5/p/10837403.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!