(pufka) decorator example 2

This commit is contained in:
anon 2024-06-07 11:48:58 +02:00
parent 53cefe3675
commit c639d069e2

23
Python/decorator.py Executable file
View File

@ -0,0 +1,23 @@
#!/bin/python3
def print_canary():
print(''' .-. \n'''
+ ''' /'v'\ \n'''
+ ''' (/ \) \n'''
+ '''='="="===<\n'''
+ '''mrf|_| \n''',
end=''
)
myBirdFunction = print_canary
myBirdFunction()
def print_with_yellow(func):
def wrapper(*args, **kwargs):
print("\033[33m")
r = func()
print("\033[0m")
return r
return wrapper
myBirdFunction = print_with_yellow(print_canary)
myBirdFunction()