I'm trying to have Python print out a .HTML file, but every time I run it, it either returns nothing or just b''
. I have not received an error while running the code. Here's the code I did:
f = open("D:\Folder\Folder\File.html", "rb")
print(f.read())
I tried using forward slash, back slash, double slash, adding r
at the front of the string (the directory for the file), and using r
instead of rb
. I have also tried using
with
instead of directly using open.
For clarification, I created the HTML file using Pandas's
df.to_html
Using open
has no problems when I am trying to print a .csv file.