Skip to content

Instantly share code, notes, and snippets.

@FaltoGH
Created March 28, 2021 14:41
Show Gist options
  • Save FaltoGH/6c7598298bbef5b0641322b9b9682462 to your computer and use it in GitHub Desktop.
Save FaltoGH/6c7598298bbef5b0641322b9b9682462 to your computer and use it in GitHub Desktop.
decorator example
import datetime
def decorator(func):
def wrapper(*args, **kwargs):
print(func.__name__, 'starttime', datetime.datetime.now().strftime('%H%M'))
ret = func(*args, **kwargs)
print(func.__name__, 'endtime', datetime.datetime.now().strftime('%H%M'))
return ret
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment