Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python在数据帧之间使用行输入写入html文件_Python_Dataframe_File Writing - Fatal编程技术网

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())