码迷,mamicode.com
首页 > 编程语言 > 详细

PythonWrongNotes

时间:2018-09-09 11:34:50      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:param   nts   def   ror   inpu   bbb   NPU   fun   col   

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.

 




 

PythonWrongNotes

标签:param   nts   def   ror   inpu   bbb   NPU   fun   col   

原文地址:https://www.cnblogs.com/liujun5319/p/9612556.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!