fork download
  1. class Query(object):
  2. def __init__(self,name):
  3. self.name=name
  4.  
  5. def __enter__(self):
  6. print('Begin')
  7. return self
  8.  
  9. def __exit__(self,exc_type,exc_value,traceback):
  10. if exc_type:
  11. print('Error')
  12. else:
  13. print('End')
  14.  
  15. def query(self):
  16. print('Query info about %s...'% self.name)
  17. # your code goes here
Success #stdin #stdout 0.1s 14160KB
stdin
Standard input is empty
stdout
Standard output is empty