1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| DEFAULT_TITLE = "Bienvenue sur ma page..."
DEFAULT_FOOTER = "Contact, Coypright(c) 20xx"
DEFAULT_BODY = ""
BASE_TEMPLATE = '''
<html>
<title>{title}</title>
<body>
{body}
</body>
{footer}
</html>
'''
def render(**options):
params = dict(title=DEFAULT_TITLE,
body=DEFAULT_BODY,
footer=DEFAULT_FOOTER)
params.update(options)
return BASE_TEMPLATE.format(**params)
if __name__ == "__main__":
print (render())
print (render(title="Welcome in this room", footer="we are busy")) |
Partager