开发者社区 问答 正文

set集合intersection_update()方法实例是什么呢?

set集合intersection_update()方法实例是什么呢?

展开
收起
游客qzzytmszf3zhq 2021-11-04 22:26:18 283 分享 版权
1 条回答
写回答
取消 提交回答
  • x = {"apple", "banana", "cherry"} # y 集合不包含 banana 和 cherry,被移除 y = {"google", "runoob", "apple"}

    x.intersection_update(y)

    print(x)

    2021-11-04 22:26:30
    赞同 展开评论