Python中集合的长度怎么获取?#Python2022-05-26分类:Python05-26 0 条评论 请先 登录 后评论 默认排序 时间排序 1 个回答|361 次阅读 2022-05-26 21:20 Coco老师 - 省科普基地老师 / 教育领域创作者 领域:编程教育 • 主页:https://kidscodes.cn/可以使用len()函数获取集合长度例如:fruitsset = {"apple", "banana", "cherry", "cherry"}print(len(fruitsset))执行结果:3注意,集合是不允许重复值的,所以重复的cherry将被忽略,长度为3 请先 登录 后评论
2022-05-26 21:20 Coco老师 - 省科普基地老师 / 教育领域创作者 领域:编程教育 • 主页:https://kidscodes.cn/可以使用len()函数获取集合长度例如:fruitsset = {"apple", "banana", "cherry", "cherry"}print(len(fruitsset))执行结果:3注意,集合是不允许重复值的,所以重复的cherry将被忽略,长度为3 请先 登录 后评论