Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- title = '~'
- elements = ''
- while True:
- line = input()
- if line == 'exit':
- break
- tag, content = line.split(' ')
- element = f'\t<{tag}>{content}</{tag}>\n'
- if tag == 'title':
- title = content
- else:
- elements += element
- title = '' if title == '~' else f' \t<title>{title}</title>\n'
- with open('index.html', 'w') as w_file:
- w_file.write(
- f"""<!DOCTYPE html>
- <html>
- <head>
- {title}</head>
- <body>
- {elements}</body>
- </html>""")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement