Last active
December 14, 2021 14:16
-
-
Save JackInTaiwan/3fda507a8803d4d30a9a0f13df834f9c to your computer and use it in GitHub Desktop.
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 time | |
def print_func_name(time): | |
def decorator(func): | |
def wrap(): | |
print("Now use function '{}'".format(func.__name__)) | |
print("Now Unix time is {}.".format(int(time))) | |
func() | |
return wrap | |
return decorator | |
@print_func_name(time=(time.time())) | |
def dog_bark(): | |
print("Bark !!!") | |
if __name__ == "__main__": | |
dog_bark() | |
# > Now use function 'dog_bark' | |
# > Now Unix time is 1639491313. | |
# > Bark !!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment