我有一组嵌套的yaml列表,如下所示:
title: the example
image: link.jpg
products:
- top-level: Product One
arbitrary: Value
nested-products:
- nested: Associated Product
sub-arbitrary: Associated Value
- top-level: Product Two
arbitrary: Value
- top-level: Product Three
arbitrary: Value
我可以使用for item in page.products
顺利地遍历产品,并且可以使用逻辑运算符来确定是否存在嵌套产品--我不能做的是在每次top-level
迭代中遍历多个nested-products
我试过使用for subitem in item
和其他选项--但我不能让它工作--有什么想法吗?
https://stackoverflow.com/questions/12761152
复制相似问题