How to write and save html file in python?

前端 未结 6 2286
挽巷
挽巷 2020-12-05 02:22

This is what I know how to write and save it

Html_file= open\"(filename\",\"w\")
Html_file.write()
Html_file.close

But how do I save to the

6条回答
  •  执笔经年
    2020-12-05 02:40

    You can do it using write() :

    #open file with *.html* extension to write html
    file= open("my.html","w")
    #write then close file
    file.write(html)
    file.close()
    

提交回复
热议问题