Python 获取集合的长度

获取集合的长度

要确定集合中有多少项,请使用 len() 方法。

实例

获取集合中的项数:

thisset = {"apple", "banana", "cherry"}

print(len(thisset))

亲自试一试