Is it possible to put In a variable a source code of an HTML file?
I mean, If I have test.html, so how can I take the source code of this html file and put it on a string ?
test.html
Just open the file and read it:
f = open('test.html', 'r') html_string = f.read() f.close()
or
with open('test.html', 'r') as f: # with can auto close the file like f.close() does html_string = f.read()