Python dictionary in to html table

后端 未结 7 1284
刺人心
刺人心 2020-12-23 21:33

Is there any way to print the python dictionary in to a table in HTML. I have a python dictionary and am sending to HTML by using

return render_template(\'i         


        
7条回答
  •  一整个雨季
    2020-12-23 22:05

    tbl_fmt = '''
     {}
    
    ''' row_fmt = ''' {} {} ''' def dict_to_html_table(in_dict): return tbl_fmt.format(''.join([row_fmt.format(k,v) for k,v in in_dict.iteritems()]))

提交回复
热议问题