如何在Python中创建类

问题描述 投票:0回答:1

先生,这是正确的代码

classNames = []mylist = os.listdir(path)

请指导我上面的代码是否正确(在Python中给出错误)

谢谢您的帮助

classNames = []mylist = os.listdir(path)

这在Python中是否是正确的代码

python class
1个回答
0
投票

这不是一个类。您正在尝试创建一个变量

class Cat:
    def print_hello(self):
        print('Meow')
© www.soinside.com 2019 - 2024. All rights reserved.