标签:哈哈哈哈哈哈 encode 内存 IV 马虎 pytho class false app
is ==
# s = "周杰伦" # s1 = s # print(id(s), id(s1)) # lst = [1, 4, 7] # lst2 = lst # lst.append("麻花藤") # print(id(lst), id(lst2)) # print(id(lst), id(lst2)) # # s1 = "alex" # s2 = "alex" # print(id(s1), id(s2)) # 内存地址是一样的 # # lst1 = [1, 4, 7] # lst2 = [1, 4, 7] # lst1.append("马虎疼") # print(lst1, lst2) # print(id(lst1), id(lst2)) # 内存地址不一样 # a = 257 # b = 257 # print(id(a), id(b)) # a = "哈哈哈哈哈哈" # b = "哈哈哈哈哈哈" # print(a is b) # # print(a == b) # a = [1, 4, 7] # b = [1, 4, 7] # print(a is b) # False 两个对象 # print(a == b) # True 内容一致 # a = (1, 8, 6) # b = (1, 8, 6) # print(a == b) # print(a is b) # lst1 = ["周杰伦", 1, 2] # lst2 = lst1 # print(lst1 is lst2) # # print(lst1 == lst2) a = 1024 b = 1024 print(a is b) print(a == b)
编码
# s = "alex" # print(s.encode("UTF-8")) # print(s.encode("GBK")) s = "哥" print(s.encode("UTF-8")) # b‘\xe5\x93\xa5‘ print(s.encode("GBK")) # b‘\xb8\xe7‘
标签:哈哈哈哈哈哈 encode 内存 IV 马虎 pytho class false app
原文地址:https://www.cnblogs.com/zuiziyouran/p/9146066.html