title: How can I restructure my code for rendering in jinja 2 template?
body: <p>I'm trying to display a values from mongo database in web application. I'm using flask framework where I'm calling function which will return lists to print in a html template. My code is as bellow</p>
  
  <pre><code>dic = mycol.find(myquery)
  </code></pre>
  
  <p>This will contents dictionary object querying from mongodatabase</p>
  
  <p>When I loop over this object I get dictionary set </p>
  
  <pre><code>for x in dic:
  </code></pre>
  
  <p>like each value of x contains</p>
  
  <pre><code>{'name':'john','age':'15','weight':'50'}
  {'name':'ash','age':'18','weight':'60'}
  {'name':'tim','age':'20','weight':'80'}
  </code></pre>
  
  <p>Code which I'm using for rendering these values as below </p>
  
  <pre><code>person_name = []
  person_age = []
  person_weight = []
  for x in dic:
      person_name.append(x["person_name"])
      person_age.append(x["person_age"]) 
      person_weight.append(x["person_weight"])
  </code></pre>
  
  <p>later I'm returning these lists for printing in html 
  jinja 2 code  is as below</p>
  
  <pre><code>{{person_name[loop.index0]}} {{person_age[loop.index0]}} {{person_weight[loop.index0]}}
  </code></pre>
  
  <p>I feel this is not better approach to do this way. So is there any other better approach to do this in a very few line of code? Thanks for reading </p>