Python:在创建html输出时保存格式

时间:2018-06-18 15:11:25

标签: python html

我正在运行像ipconfig这样的Windows命令,并尝试在html页面中捕获它们。我遇到的问题是格式化不是我想要的。我有一个写我的html的函数。

def writeHTML(toWrite):
    output.write("<p>")
    if toWrite.find("   ") == 1:
        toWrite.replace("   ", "&nbsp")
    output.write(toWrite)
    print(toWrite)
    output.write("</p>")

我试过&#34;发现&#34; \ t和空白但是泡沫不起作用。

首选输出:

enter image description here

当前输出:

enter image description here

如何保持格式?

0 个答案:

没有答案