摘要: code class mytest(): def __str__(self): return "hello" def __repr__(self): return "world" a=mytest() print(a) print(str(a)) print(repr(a)) outputs mac 阅读全文
posted @ 2020-09-13 15:42 anobscureretreat 阅读(248) 评论(0) 推荐(0)
摘要: 从对象内存地址方向来说 可变数据类型:在内存地址不变的情况下,值可改变(列表和字典是可变类型,但是字典中的 key 值必须是不可变类型) 不可变数据类型:内存改变,值也改变。(数字,字符串,布尔类型,都是不可变类型)可以通过 id() 方法进行内存地址的检测。 阅读全文
posted @ 2020-09-13 12:15 anobscureretreat 阅读(485) 评论(0) 推荐(0)
摘要: 字符串(String)、 数字(Digit)、 列表(List)、 元组(Tuple)、 集合(Sets)、 字典(Dictionary)。 阅读全文
posted @ 2020-09-13 12:12 anobscureretreat 阅读(430) 评论(0) 推荐(0)