+ 1
Pardon my ignorance but How could I get the wrap function to wrap each letter?
def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): a = "Hello world!" for i in a: print(i) decorated = decor(print_text) decorated()
2 Answers
+ 2
def decor(func):
def wrap():
print("============")
func()
print("============")
return wrap
def print_text():
a = "Hello world!"
print(a)
decorated = decor(print_text)
decorated()
""" or do you trying this ? Israel Romario Soares
def decor(func):
def wrap():
print("============")
func()
print("============")
return wrap
def print_text():
print(i)
a = "Hello world!"
decorated = decor(print_text)
for i in a :
decorated()
"""
+ 1
Jayakrishnađźđł thanks much. đđŸ