标签:
>>> from hello import Hello >>> h = Hello() >>> h.hello() Hello, world. >>> print(type(Hello)) <type ‘type‘> >>> print(type(h)) <class ‘hello.Hello‘>
要创建一个class对象,type()
函数依次传入3个参数:
fn
绑定到方法名hello
上。标签:
原文地址:http://www.cnblogs.com/Citizen/p/4285489.html