代码如下:
class Student(object): def __init__(self, name): self.name = name print(Student('Michael')) Student('Michael')
为什么运行print(Student('Michael'))的结果是“<__main__.Student object at 0x0000015B4B214130>”
而运行Student('Michael')的结果是“<__main__.Student at 0x15b4b214970>”?????
每次都创建了一个不一样的实例啊,地址当然不一样了
不是啊 我是说 下面那个多了一个object
不是啊 我是说 上面那个多了一个object
Sign in to make a reply
楠先森咩
代码如下:
为什么运行print(Student('Michael'))的结果是“<__main__.Student object at 0x0000015B4B214130>”
而运行Student('Michael')的结果是“<__main__.Student at 0x15b4b214970>”?????