python为类定义构造函数

用python进行OO编程时, 经常会用到类的构造函数来初始化一些变量。

class FileData:
    def __init__(self, data, name, type):
        self.bits = base64.encodestring(data)
        self.name = name
        self.type = type

其中self类似c++或者c#的this指针。
原文地址:https://www.cnblogs.com/muzizongheng/p/3198493.html