Created
March 28, 2021 14:41
-
-
Save FaltoGH/6c7598298bbef5b0641322b9b9682462 to your computer and use it in GitHub Desktop.
decorator example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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