我用Pandas从一个用Python语言写的网站上抓取了一个表格,把它转换成超文本标记语言(df.to_html()),然后插入到Mongodb中。它在Mongodb中存储如下表{‘==> _html_table’:‘...’} In the Mongodb 然后,当我使用Flask和pymongo检索数据并将其显示在我的网站上时,它显示的是文本而不是表格。 有没有什么函数可以把文本(从Mongodb)转换成HTML?或者一种将HTML标签插入Mongodb的方法,在Mongodb中我可以将其用作HTML标签。
我通过复制then,然后复制th宽度来克隆一个表标题行。但这是失败的,因为宽度被写为(宽度减去W)像素时边框:'Wpx‘和边框折叠:’折叠‘。如果不设置边框折叠,则正确写入宽度。
“守则”很简单:
var arr = [];
// copy html, where abc is the destination <tr> and def is the source
$abc.html($def.html());
// now copy widths of table header cells
$def.children().each(function() {arr.p