标签:key qiniu print ini bcd python one 字典 str
in
判断单个元素是否在序列中, 对字典来说只能判断key
print("ab" in "abcdefg") print("abc" in ["abc", "ac"]) print([1, 2] in [[1, 2], "3"]) print("abc" in {"abc": 33}) print(33 in {"abc": 33})
is
身份判断,判断内存地址是否相等
nameOne = "BeiMenChuiXue" nameTwo = "QiNiuYun" nameThree = "QiNiuYun" print(nameOne is nameTwo, id(nameOne), id(nameTwo)) print(nameTwo is nameThree, id(nameTwo), id(nameThree))
==
判断值是否相等
nameOne = "BeiMenChuiXue" nameTwo = "QiNiuYun" nameThree = "QiNiuYun" print(nameOne == nameTwo) print(nameTwo == nameThree)
相同点
in is == 返回都是bool类型
标签:key qiniu print ini bcd python one 字典 str
原文地址:https://www.cnblogs.com/2bjiujiu/p/9085918.html