python在数据帧之间使用行输入写入html文件
我尝试了所有选项,但仍然得到:python在数据帧之间使用行输入写入html文件,python,dataframe,file-writing,Python,Dataframe,File Writing,我尝试了所有选项,但仍然得到: 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(&q
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
打开(“a.html”,“w”)作为_文件:
_file.write(df_total_events.to_html())
_file.write(“ddddfhgfghfghgh”+”
)
_file.write(“
”)
_file.write(“
”)
_file.write(“dddsssddd”)
_file.write(df_total_events.to_html())
您还可以将多个换行符“
”添加到一起,如“
”如果它是html文件,我想您需要将其用于换行符。
df_total_events table
ddddfhgfghfghfgh
dddssssssssddd
df_total_events table
with open("a.html", 'w') as _file:
_file.write(df_total_events.to_html())
_file.write("ddddfhgfghfghfgh"+'<br/>')
_file.write("<br/>")
_file.write("<br/>")
_file.write("dddssssssssddd")
_file.write(df_total_events.to_html())