为什么我把svg写进html文件,打开后内容是空白的

python小白一枚,我在用pygal生成的几个svg图片,想把他们放到一个
html文件里面,但是生成的html文件打开是空白。
这个代码在《python编程从入门到实践》16章里面有。的谁能帮我解决问题?
代码如下:
#书本里没有import package


with open("收盘价Dashboard.html",'a',encoding='utf-8') as  html_file:
    html_file.write('<html><head><title>收盘价Dashboard</title><meta
        charset="utf-8"></head><body>\n')
    for svg in  ['收盘折线图.svg','收盘价对数变换折线图.svg',
                    '收盘价月日均收益¥.svg',
                    '收盘价周日均值¥.svg',"收盘价星期均值¥.svg"]:
        html_file.write('   <object type="image/svg+xml" date="{0}"'
                        'height=500></object>\n'.format(svg))
        html_file.write('</body></html>')

    ```
def with_test():
    with open("收盘价Dashboard.html", 'a', encoding='utf-8') as html_file:
        html_file.write('收盘价Dashboard charset = "utf-8" >\n')
        txtlist = ['收盘折线图.svg', '收盘价对数变换折线图.svg',
                    '收盘价月日均收益¥.svg',
                    '收盘价周日均值¥.svg', "收盘价星期均值¥.svg"]
        for svg in txtlist:
            with open(svg, 'rb') as f:
                bian_ma = base64.b64encode(f.read())
                message = '<img src="data:image/png;base64,' + str(bian_ma, encoding='utf-8') + '"/>'
                with open('a.html', 'w') as f3:
                    f3.write(message)
if __name__ == '__main__':
    with_test()
    #希望能帮助到你

图片说明

哈哈 你用记事本打开 生成的 html 文件 看看 里面的文件名 和之前生成的五个图标的文件名是否一致,一定要仔细啊