Schreiben Sie das vorige Beispiel so um, dass man einen beliebigen String mit einem Tag, umgibt:
Zum Beispiel:
<h1>
My string!
</h1>
from contextlib import contextmanager
@contextmanager
def tag(name):
print("<%s>" % name)
yield
print("</%s>" % name)
with tag("h1"):
print("My string!")