可以使用len()函数获取集合长度例如:fruitsset = {"apple", "banana", "cherry", "cherry"}print(len(fruitsset))执行结果:3注意,集合是不允许重复值的,所以重复的cherry将被忽略,长度为3