python 编程辅导、辅导python open fiile 程序

- 首页 >> Python编程

# create a html file - using functions


def open_file(name):

   file_write = open(name, 'w')

   return file_write


def write_header(filename):

   filename.write("""

   <html>


       <title>

       Test THT2 page

       </title>

       

   """)


def write_footer(filename):

   filename.write("""

   </html>""")


def close_file(filename):

   filename.close()



filename = open_file('Test02_Australia.html')

write_header(filename)


# write the contents of the hmtl page

# TO DO


write_footer(filename)

close_file(filename)


站长地图