Python可以把列表的元素添加到集合中吗?#Python2022-05-26 21:43分类:Python 0 条评论 请先 登录 后评论 默认排序 时间排序 1 个回答|346 次阅读 2022-05-26 21:45 Coco老师 - 官方公众号:青少儿编程学习网 擅长:编程教育 • 网站:https://kidscodes.cn/可以,任何可迭代的对象(元组、列表、字典等),都可以通过update()方法添加元素到集合中thisset = {"apple", "banana", "cherry"}mylist = ["kiwi", "orange"]thisset.update(mylist)print(thisset)执行结果:{'cherry', 'banana', 'orange', 'apple', 'kiwi'} 请先 登录 后评论