Jinja2中的變量在循環(huán)中的作用域只是循環(huán)內(nèi),循環(huán)外的變量是無法在循環(huán)內(nèi)改變值的,因此用namespace來解決。 image.png