PythonWrongNotes

1.  

def auth(func):
def inDecoretor(*args,**kwargs):
username = input("username:")
password = input("password:")
func(args,kwargs) //TypeError: home() takes 0 positional arguments but 2 were given
return inDecoretor

def auth(func):
def inDecoretor(*args,**kwargs):
username = input("username:")
password = input("password:")
func(*args,*kwargs)
return inDecoretor

2.

def auth(): //TypeError: auth() takes 0 positional arguments but 1 was given
def outDecoretor(func):
def inDecoretor(*args, **kwargs):
username = input("username:")
password = input("password:")
func(*args, **kwargs)
return inDecoretor
return outDecoretor

@auth
def home():
print("this is home")



def auth(autoType):
def outDecoretor(func):
def inDecoretor(*args, **kwargs):
username = input("username:")
password = input("password:")
func(*args, **kwargs)
return inDecoretor
return outDecoretor

@auth("parameter")
def home():
print("this is home")
 

 

3.

4.

5.

6.

 




 

posted on 2018-09-09 09:13  langjitianyadaolao  阅读(108)  评论(0编辑  收藏  举报

导航