Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 529 Bytes

40.md

File metadata and controls

27 lines (21 loc) · 529 Bytes
@author jackzhenguo
@desc 
@date 2019/3/10

40 对象门牌号 

In [1]: class Student():
   ...:     def __init__(self,id,name):
   ...:         self.id = id
   ...:         self.name = name
   ...:     def __repr__(self):
   ...:         return 'id = '+self.id +', name = '+self.name

In [2]: xiaoming = Student(id='001',name='xiaoming')

返回对象的内存地址

In [1]: id(xiaoming)
Out[1]: 98234208
[上一个例子](39.md) [下一个例子](41.md)