• 2022-07-01 问题

    在定义类方法之前,必须先使用( )进行声明。 A: @classmethod B: @staticmethod C: 不需要事先声明

    在定义类方法之前,必须先使用( )进行声明。 A: @classmethod B: @staticmethod C: 不需要事先声明

  • 2022-05-31 问题

    以下类方法定义正确的是() A: class Student: fav=("唱歌","跳舞","绘画") def showFav(cls): for item in cls.fav: print(item) B: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in fav: print(item) C: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in cls.fav: print(item) D: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(): for item in fav: print(item)

    以下类方法定义正确的是() A: class Student: fav=("唱歌","跳舞","绘画") def showFav(cls): for item in cls.fav: print(item) B: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in fav: print(item) C: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in cls.fav: print(item) D: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(): for item in fav: print(item)

  • 2021-04-14 问题

    定义类时,在一个方法前面使用@classmethod进行修饰,则该方法属于类方法

    定义类时,在一个方法前面使用@classmethod进行修饰,则该方法属于类方法

  • 2022-05-29 问题

    在Python中定义类时,若在一个方法前面使用@classmethod修饰符,则该方法属于静态方法。

    在Python中定义类时,若在一个方法前面使用@classmethod修饰符,则该方法属于静态方法。

  • 2022-06-04 问题

    在声明一个方法为类的静态方法,需要添加装饰符的名字为() A: property B: method C: classmethod D: staticmethod

    在声明一个方法为类的静态方法,需要添加装饰符的名字为() A: property B: method C: classmethod D: staticmethod

  • 2022-05-31 问题

    以下类方法定义正确的是() A: class Student: fav=("唱歌","跳舞","绘画") def showFav(cls): for item in cls.fav: print(item) B: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in fav: print(item) C: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in cls.fav: print(item) D: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(): for item in fav: print(item)

    以下类方法定义正确的是() A: class Student: fav=("唱歌","跳舞","绘画") def showFav(cls): for item in cls.fav: print(item) B: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in fav: print(item) C: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in cls.fav: print(item) D: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(): for item in fav: print(item)

  • 1