0
None type error
I tried decorated function in python 3.7.3 shell By using code def decor (func): def wrap( ): Print ("=========") func( ) Print ("=========") return wrap def text( ): print ("Ganesh") Decorated=decor(text) Decorated( ) But this shows typeerror: 'nonetype' in my system Can you suggest me what to do
2 ответов
+ 1
Thank you😁✌🏼
0
def decor(func):
def wrap():
print("=========")
func()
print("=========")
return wrap
def text():
print("Ganesh")
Decorated = decor(text)
Decorated()
Note the indentation level of "return wrap". In your code, the inner function wrap() is never called