2024-09-27 21:30:06 发布
网友
假设我有
df.to_html('table.html', classes='tablecss')
它将输出一个表:
<table border="1" class="dataframe tablecss">
如何使它只显示“tablecss”而不显示“dataframe tablecss”?你知道吗
最简单的解决方案(也许有更干净的解决方案):
import re html_updated = re.sub("class=\"dataframe ", "class=\"", df.head(5).to_html(classes='tablecss')) with open("table.html", "w") as ouput_file: ouput_file.write(html_updated)
最简单的解决方案(也许有更干净的解决方案):
相关问题 更多 >
编程相关推荐