<div tal:define="number python: 1">
<tal:block repeat="item s_items">
    <div tal:define="number python: number + 1">     
         <div tal:content="python: number">none</div>
     </div> 
</tal:block>
</div>

Hi, always show 2. but I would like to show 2 3 4 5 ... How to do? Thanks

Recommended Answers

All 2 Replies

test_list = \
['<div tal:define="number python: 1">',
'<tal:block repeat="item s_items">',
'    <div tal:define="number python: number + 1">',     
'         <div tal:content="python: number">none</div>',
'     </div>', 
'</tal:block>',
'</div>' ]

found = False
for rec in test_list:
    if rec.strip().startswith("<tal"):
        found = True
    elif rec.strip().startswith("</tal"):
        found = False
    if found:
        print rec

Thanks, but i will this put in template, so i will all made with TAL

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.