in 和 not in 操作符
请注意,
在前面的例子中,‘name’ in spam 本质上是一个简写版本。相当于'name' in spam.keys()
判断数据类型:
python3 判断数据类型
def estType():
eventList = [1, 'Tom', {'name': 'Lucy', 'age': 16, 'grade': 98}]
print(type(eventList[0]) is int)
print(type(eventList[1]) is int)
print(type(eventList[1]) is str)
print(type(eventList[2]) is dict)
结果:
True False True True