Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # SimpleSample save as HTML
- def save_html(file_name, title, body):
- try:
- html = '''
- <html>
- <head>
- <title>{title}</title>
- </head>
- <body>
- {body}
- </body>
- </html>
- '''.format(title=title, body=body)
- with open(file_name, "w") as f:
- f.write(html)
- except:
- print("Error during writing")
- save_html("index.html", "My WebPage", "Hello World!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement