this program encapsulates two basic operations into the last two functions that will be used over and over the firststrtofilehas nothing newit just puts specified text in file with specified name the secondbrowselocaldoes more it takes specified text (presumably web page)puts it in fileand directly displays the file in your default web browser it uses the open function from the webbrowser module to start the new page in your web browser the open function here requires the name of file or url since the page is automatically generated by the program for one-time immediate viewingit automatically uses the same throwaway filenametempbrowselocal html specified as the default in the keyword parameter if you really want another specificname you could pass it as parameter in this particular program the text that goes in the file is just copied from the literal string named contents in the program this is no advance over just opening the file in the browser directlystillit is start towards the aim of creating web content dynamically an early example in this tutorial displayed the fixed hello world!to the screen this was later modified in hello_you py to incorporate user input using the string format method of dictionaries and string formatting (page )person input('enter your name'greeting 'hello {person}!format(**locals()print(greetingsimilarlyi can turn the web page contents into format stringand insert user data load and run the www example program helloweb py the simple changes from helloweb py are marked at the beginning of the file and shown below modified the web page text to contain 'hello{person}!in place of 'helloworld!'making the string into format stringwhich renamed to the more appropriate pagetemplate the changed initial portion with the literal string and and the main program then becomes pagetemplate ''<meta content="text/htmlcharset=iso- - http-equiv="content-type"hello hello{person}''new note '{person}two lines up def main()new person input("enter name"contents pagetemplate format(**locals()browselocal(contentsnow the line contents pagetemplate format(**locals()incorporaties the person' name into the contents for the web page before saving it to file and displaying it in this casei stored the literal format string inside the python programbut consider different approachload and run the www example program helloweb py it behaves exactly like helloweb pybut is slightly different internally it does not directly contain the web page template string instead the web page template string is read from the file hellotemplate html dynamic web pages