with_list
不展开循环嵌套的列表。功能类似于
for i in zip([1,2,3],['a','b','c']): print(i)
- hosts: all
tasks:
- name: debug
debug:
msg: "{{ item }}"
with_list
- ["a","b","c"]
- [1,2,3]
而with_item 会展开循环,可以理解为
def with_item(obj):
for i in obj:
if isinstance(i ,list ):
with_item(i)
else:
print(i)
with_item([[1,2,3],['a','b',['c','d']]])
标签:语句,obj,debug,list,item,循环,print
From: https://www.cnblogs.com/wangend/p/17062426.html