使用金字塔时,我的代码如下所示:
class PageData:
@staticmethod
def create_data():
return [
{
'key_1A': 'info1A',
'key_2A': 'info2A',
'nested_list_A': [
{'nested_key1A': 'nested_val1A'},
{'nested_key2A': 'nested_val2A'},
],
},
{
'key_1A': 'info1B',
'key_2A': 'info2B',
'nested_list_B': [
{'nested_key1B': 'nested_val1B'},
{'nested_key2A': 'nested_val2A'},
],
},
]
我的html页面代码如下:
^{pr2}$引用嵌套密钥的正确语法是什么?为了tal:条件语句? 在
在试图弄清楚这一点时,我找到了我的答案。。。在
a成为nest_list_a例如的赋值 b成为a.nested_list_a的赋值,后者将访问它们的键
如果键有值,则塔尔:条件会继续正常操作,否则渲染时将跳过。在
相关问题 更多 >
编程相关推荐