Python Set symmetric_difference_update() 方法

Python 3 教程 · 2019-02-06 21:14:48

描述

symmetric_difference_update() 方法移除当前集合中在另外一个指定集合相同的元素,并将另外一个指定集合中不同的元素插入到当前集合中。

语法

symmetric_difference_update() 方法语法:

set.symmetric_difference_update(set)

参数

  • set -- 要检测的集合

返回值

无。

实例

在原始集合 x 中移除与 y 集合中的重复元素,并将不重复的元素插入到集合 x 中:

实例 1

x = {"apple", "banana", "cherry"} y = {"google", "codercto", "apple"} x.symmetric_difference_update(y) print(x)

输出结果为:

{'google', 'cherry', 'banana', 'codercto'}

点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html

查看所有标签

Getting Started with C++ Audio Programming for Game Development

Getting Started with C++ Audio Programming for Game Development

David Gouveia

Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD li......一起来看看 《Getting Started with C++ Audio Programming for Game Development》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具