微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python用数据行之间的行输入到html文件

如何解决python用数据行之间的行输入到html文件

with open("a.html",'w') as _file:
    _file.write(df_total_events.to_html())
    _file.write("ddddfhgfghfghfgh"+'\n')
    _file.write("\n")
    _file.write(""+"\n")
    _file.write("dddssssssssddd")
    _file.write(df_total_events.to_html())

我尝试了所有选项,但仍然得到:

df_total_events table
ddddfhgfghfghfgh dddssssssssddd
df_total_events table

我想在数据框和句子之间留出足够的空间:

    df_total_events table

    ddddfhgfghfghfgh

    dddssssssssddd


    df_total_events table

解决方法

m,N = np.array([1,2,3]),1000

np.random.seed(42)
samples = np.random.randn(N,len(m)) + m

您也可以像这样“

”一起添加多个换行符“

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。