# to open/create a new html file in the write mode f = open('GFG.html', 'w') # the html code which will go in the file GFG.html html_template = """ Title

Welcome To GFG

Default code has been loaded into the Editor.

""" # writing the code into the file f.write(html_template) # close the file f.close()