fork download
  1. from contextlib import contextmanager
  2.  
  3. @contextmanager
  4. def tag(name):
  5. print("<%s>" % name)
  6. yield
  7. print("</%s>" % name)
  8.  
  9. with tag('h1') :
  10. print('Hello')
Success #stdin #stdout 0.02s 9140KB
stdin
Standard input is empty
stdout
<h1>
Hello
</h1>