?在pyecharts制作可视化大屏后,可以使用bs4库对可视化大屏进行背景色等参数进行修改
from bs4 import BeautifulSoup
import os
with open(os.path.join(os.path.abspath("."), "new_page_demo.html"), 'r+', encoding="utf8") as html:
html_bf = BeautifulSoup(html, "lxml")
divs = html_bf.find_all("div")
body = html_bf.find("body")
body["style"]="background-color:#333333;"
# div_title = "<div align=\"center\" style=\"width:1900px;\">\n<span style=\"font-size:30px;font face=\'黑体\';color :#FFFFFF\"><b>CD_NOW数据看板</b></div>" # 修改页面背景色、追加标题
# body.insert(0, BeautifulSoup(div_title, "lxml").div)
html_new = str(html_bf)
html.seek(0, 0)
html.truncate()
html.write(html_new)
html.close()
?
|