zoukankan      html  css  js  c++  java
  • 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.




     

  • 相关阅读:
    docker-5-容器数据卷
    docker-4-镜像
    docker-3-常用命令(下)
    docker-3-常用命令(中)
    docker-3-常用命令(上)
    docker-2-安装
    Python中Unicode字符串
    Python中整数和浮点数
    Python中什么是变量
    Python中数据类型
  • 原文地址:https://www.cnblogs.com/liujun5319/p/9612556.html
Copyright © 2011-2022 走看看