Write a program in python that takes a txt file and converts it to html
Write a program in python that takes a txt file and converts it to html
Just change your code to include <pre>
and
</pre>
tags to ensure that your text stays
formatted the way you have formatted it in your original text
file.
contents = open"C:\\Users\\Suleiman JK\\Desktop\\Static_hash\\test","r")
with open("suleiman.html", "w") as e:
for lines in contents.readlines():
e.write("<pre>" + lines + "</pre> <br>\n")
In the contents variaable you should give uour own path for the changing of file from txt to html.
Get Answers For Free
Most questions answered within 1 hours.