Error in user YAML: (<unknown>): could not find expected ':' while scanning a simple key at line 3 column 1
---
- oeasy Python 0148
- 这是 oeasy 系统化 Python 教程,从基础一步步讲,扎实、完整、不跳步。愿意花时间学,就能真正学会。
本教程同步发布在:
个人网站: `https://oeasy.org`
蓝桥云课: `https://www.lanqiao.cn/courses/3584`
GitHub: `https://github.com/overmind1980/oeasy-python-tutorial`
Gitee: `https://gitee.com/overmind1980/oeasypython`
---
| 比较运算符 |
字典 (dict) |
集合 (set) |
== |
键值对完全相同则为 True 顺序不影响 |
元素完全相同则为 True 顺序不影响 |
!= |
键/值有任一不同 → True |
元素有任一不同 → True |
<、<=、>、>= |
❌ 直接报错 字典不支持大小比较 |
✅ 支持 表示子集/超集关系 |

| 判断条件 |
结果 |
| 是成员 |
True |
| 不是成员 |
False |


| 判断条件 |
结果 |
| 是元组成员 |
True |
| 不是元组成员 |
False |

| 判断条件 |
结果 |
| 是成员 |
True |
| 不是成员 |
False |




| 判断条件 |
结果 |
| 是成员 |
True |
| 不是成员 |
False |

"a" in {"a": 1, "b": 2}
{"a": 1, "b": 2}.keys()
set({"a": 1, "b": 2}.keys())
"a" in {"a": 1, "b": 2}.keys()

d = {"age":41,"name":"oeasy","score":(66,67)}
if "height" in d:
print("height",":",d["height"])


type(1)
type((1))
type((1,))
type((1,)) in [list, tuple, str]

- 这次研究了 in
- 成员测试 运算符
- Membership test operations
| 判断 |
结果 |
| 在容器里 |
True |
| 不在容器里 |
False |

- 这个 not in 是什么意思呢??🤔
- 下次再说 👋
- 本文来自 oeasy Python 系统教程。
- 想完整、扎实学 Python,
- 搜索 oeasy 即可。