delucaspinto

Sort Zip with Jinja

May 9th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. //app.py
  2. dt=zip(dec.data.anames, dec._rank, dec.e_.points)
  3.  
  4. //index.html
  5. {% for x,y,z in dt|sort(attribute=2, reverse=True)  %}     
  6. <tr>
  7. <td>{{ x }}</td>
  8. <td>{{ y }}</td>
  9. <td>({{'%0.2f'| format(z | float)}}%)</td>
  10. </tr>
  11. {% endfor %}
Advertisement
Add Comment
Please, Sign In to add comment