python 中的集合问题
我们可以从集合中删除一个条目吗?
使用什么命令?
就像,我的设置包含 (6,5) 、(6,7)、(7,9) ...我需要删除第二个条目...我该做什么?
can we remove a entry from the sets.
what are the commands to use for it?
like, my set conatins (6,5) , (6,7), (7,9)...I need to remove the second entry...what shud I do??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
remove()
方法可用于从集合中删除项目。The
remove()
method can be used to remove items from a set.您可以使用
remove()
:You can use
remove()
:a -= 设置([(6, 7)])
:-)
a -= set([(6, 7)])
:-)
如果您有这些元组的列表,您可以像这样清除它:
If you've got a list of those tuples you can clear it out like this: