ansible roles 在被引用时如何传递变量 2016/10/31 | Ansible 入门 | Zhiming Zhang | 2 条评论 | 7953 views ansible很亮的功能之一就是role, 我们可以将不同分类的task 归类之后放到一个相同的role中,方便管理,方便重用 一个简单的role: Default roles/ `-- test `-- tasks `-- main.yml 1234 roles/`-- test `-- tasks `-- main.yml 是的,有一个role 名字叫 test ,test这个role下只有一个文件夹,tasks, 只有一个yml文……
python里的比较少见的函数 map() partial() 2016/10/25 | python | Zhiming Zhang | 暂无评论 | 3190 views map()是python的一个内建函数, 他能够通过函数来处理序列,比如,我们相关一个数组[0,1,2,3,4,5]所有的数字都+2 , 当然,我们可以这么做 Python old = [0,1,2,3,4,5] new = [] for item in old: new.append(item+2) print new 123456 old = [0,1,2,3,4,5]new = []for item in old: new.append(item+2) print new 有点小题大做的感觉,map就是解决这个问题的 Python old = [0,1,2,3,4,5] new = map((lambda x:x+2),old) print new 123 old = [0,1,2,3,4,5]new = map((lambda x:x+2),old)print new m……