page contents

如何在Python中创建类?

轩辕小不懂 发布于 2021-07-06 14:34
阅读 697
收藏 0
分类:Python开发
1213
Nen
Nen
- 程序员

Python中的类是使用class关键字创建的。举例如下:

class Employee:

    def __init __(self,name):

        self.name = name 

        E1 = Employee("abc")

        print(E1.name)

请先 登录 后评论