python - Write a template that takes two column names and applies a simple equation to the values -


i have table number of columns. trying write jinja2 template take names of 2 of columns , use these cell values of each column. needs loop through these pairs , apply simple mathematical formula (i.e. cell1 * cell2) , thing need rendered template resultant value.

a column has name , cells attribute.

this seems should quite simple achieve having problems it. may due unfamiliarity python come js background , have started using python.

any problem appreciated.

thanks time.

update:

column a:

{   name: 'column 1',    cells: [     {value: 1000},      {value: 1000},      {value: 1000}   ] } 

column b:

{   name: 'column 5',    cells: [     {value: 11},      {value: 39},      {value: 50}   ] } 

this template applied values in table react component, , evaluated on back-end.

if done in python need:

a = {   'name': 'column 1',   'cells': [     {'value': 1},      {'value': 2},      {'value': 3}   ] }  print a['cells'][0]['value']*a['cells'][1]['value'] 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -