+ 1

Problem with decorator function in python

The function returns the expected string but also None, why? text = input() def uppercase_decorator(func): def wrapper(text): text=text.upper() func(text) return wrapper @uppercase_decorator def display_text(text): print(text) print(display_text(text))

14th Dec 2020, 7:33 PM
Thiago Silva
Thiago Silva - avatar
3 ответов
+ 1
Thanks a lot!
14th Dec 2020, 7:58 PM
Thiago Silva
Thiago Silva - avatar
+ 1
Thanks for the enlightenment!
14th Dec 2020, 7:59 PM
Thiago Silva
Thiago Silva - avatar
0
Try this - it worked for me: #your code goes here return func(text.upper()) return wrapper
18th Nov 2021, 10:56 AM
Stefan Bartl
Stefan Bartl - avatar