Python 如果我没有';我不知道钥匙

Python 如果我没有';我不知道钥匙,python,wkhtmltopdf,mustache,pdfkit,Python,Wkhtmltopdf,Mustache,Pdfkit,我正在尝试使用wkhtmltopdf呈现胡子模板。 我想动态显示(税的)键/值,因为它们不是固定的。表标题中的键和作为数据的值 这是模板的参数(“使用的服务”): data:[ { "service_used_id": "0f64b162", "service_amount": 221.7, "service_name": "Chicken

我正在尝试使用wkhtmltopdf呈现胡子模板。 我想动态显示(税的)键/值,因为它们不是固定的。表标题中的键和作为数据的值

这是模板的参数(“使用的服务”):


    data:[
    {
        "service_used_id": "0f64b162",
        "service_amount": 221.7,
        "service_name": "Chicken Biriyani",
        "tax": {"SGST6": 14.15, "CGST6": 14.15 },
        "tax_inclusive": 0,
        "service_category": "food",
        "total_service_amount": 250,
        "service_id": "s002",
        "service_date": "Mon, 23 Nov 2020 00:00:00 GMT",
        "quantity": 1
    },
    {
        "service_used_id": "ebd4396f",
        "service_amount": 60,
        "service_name": "Mineral water",
        "tax": {"SGST3": 3.6,"CGST3": 3.6},
        "service_category": "drinks",
        "total_service_amount": 67.2,
        "service_id": "s001",
        "service_date": "Fri, 20 Nov 2020 00:00:00 GMT",
        "quantity": 2
    }
    ]


    <table class="service-table">
    
        <thead>
               <th>Date</th>
               <th>Service name</th>
               <th>Qty</th>
               <th>HSN</th>
               <th>Amount</th>
               <th>Taxable</th>
               {!--
               {{#tax.keys}} **I want to display the keys of "tax": {"SGST6": 3.6,"CGST6": 3.6},**
               <th>{{.}}</th>
               {{/tax}} 
               --!}
               <th>Total</th>
        </thead>
        <tbody>
           {{#services_used.data}}
           <tr>
             <td>{{service_date}}</td>
             <td>{{service_name}}</td>
             <td>{{quantity}}</td>
             <td></td>
             <td>{{service_amount}}</td>
             <td>0</td>
             {{#tax}}
             <td>{{.}}</td>
             {{/tax}}
             <td>{{total_service_amount}}</td>
           </tr>
           {{/services_used.data}}
           <tr>
             <td colspan="4" style="text-align: right;">Total</td>
             <td>{{services_used.amount_sum}}</td>
             <td>0</td>
             {!--
             {{#tax.values}}
             <td>{{.}}</td>  And the values here dynamically
             {{/tax}}
             --!}
             <td>{{services_used.total_amount_sum}}</td>
           </tr>
       </tbody>
    </table>

这是我的.小胡子模板:


    data:[
    {
        "service_used_id": "0f64b162",
        "service_amount": 221.7,
        "service_name": "Chicken Biriyani",
        "tax": {"SGST6": 14.15, "CGST6": 14.15 },
        "tax_inclusive": 0,
        "service_category": "food",
        "total_service_amount": 250,
        "service_id": "s002",
        "service_date": "Mon, 23 Nov 2020 00:00:00 GMT",
        "quantity": 1
    },
    {
        "service_used_id": "ebd4396f",
        "service_amount": 60,
        "service_name": "Mineral water",
        "tax": {"SGST3": 3.6,"CGST3": 3.6},
        "service_category": "drinks",
        "total_service_amount": 67.2,
        "service_id": "s001",
        "service_date": "Fri, 20 Nov 2020 00:00:00 GMT",
        "quantity": 2
    }
    ]


    <table class="service-table">
    
        <thead>
               <th>Date</th>
               <th>Service name</th>
               <th>Qty</th>
               <th>HSN</th>
               <th>Amount</th>
               <th>Taxable</th>
               {!--
               {{#tax.keys}} **I want to display the keys of "tax": {"SGST6": 3.6,"CGST6": 3.6},**
               <th>{{.}}</th>
               {{/tax}} 
               --!}
               <th>Total</th>
        </thead>
        <tbody>
           {{#services_used.data}}
           <tr>
             <td>{{service_date}}</td>
             <td>{{service_name}}</td>
             <td>{{quantity}}</td>
             <td></td>
             <td>{{service_amount}}</td>
             <td>0</td>
             {{#tax}}
             <td>{{.}}</td>
             {{/tax}}
             <td>{{total_service_amount}}</td>
           </tr>
           {{/services_used.data}}
           <tr>
             <td colspan="4" style="text-align: right;">Total</td>
             <td>{{services_used.amount_sum}}</td>
             <td>0</td>
             {!--
             {{#tax.values}}
             <td>{{.}}</td>  And the values here dynamically
             {{/tax}}
             --!}
             <td>{{services_used.total_amount_sum}}</td>
           </tr>
       </tbody>
    </table>

谢谢