这边有如下代码:
class AlbumS3Handler:
def Test(str):
print str
return True
if __name__ == "__main__":
handler = ALbumS3Handler()
handler.Test("hello")
报错:
TypeError: Test() takes exactly 1 argument (2 given)
这个是因为python类中函数定义时需要加入参数self。因为python在调用Test这个函数的时候会隐式的传入这个对象的instance。即c++中这个对象的地址。