ntp symmetric

设置symmetric_difference_update()方法 (Set symmetric_difference_update() Method)

symmetric_difference_update() method is used to get the list of all elements which are not common in both sets and update this set (set1) with these elements or we can say this method is used to update this set (set1) by removing the elements which are common in both sets.

symmetric_difference_update()方法用于获取两个集合中都不通用的所有元素的列表,并使用这些元素更新该集合( set1 ),或者我们可以说此方法用于通过删除以下元素来更新此集合( set1 ):在这两种情况下都很常见。

Syntax:

句法:

    set1.symmetric_difference_update(set2)

Parameter(s):

参数:

  • set2 – It represents another set to be compared with this set (set1).

    set2 –代表另一个要与此集合进行比较的集合( set1 )。

Return value:

返回值:

The return type of this method is <class 'NoneType'>, it updates this set (set1) by removing the elements which are common in both sets.

此方法的返回类型为<class'NoneType'> ,它通过删除两个集合中共同的元素来更新此集合( set1 )。

Example 1:

范例1:

# Python Set symmetric_difference_update()
# Method with Example
# declaring the sets
cars_1 = {"Porsche", "Audi", "Lexus"}
cars_2 = {"Porsche", "Mazda", "Lincoln"}
# printing sets before symmetric_difference_update()
print("Before calling symmetric_difference_update()...")
print("cars_1:", cars_1)
print("cars_2:", cars_2)
# symmetric_difference_update() method call
cars_1.symmetric_difference_update(cars_2)
# printing sets after symmetric_difference_update()
print("After calling symmetric_difference_update()...")
print("cars_1:", cars_1)
print("cars_2:", cars_2)

Output

输出量

Before calling symmetric_difference_update()...
cars_1: {'Audi', 'Lexus', 'Porsche'}
cars_2: {'Porsche', 'Mazda', 'Lincoln'}
After calling symmetric_difference_update()...
cars_1: {'Mazda', 'Audi', 'Lincoln', 'Lexus'}
cars_2: {'Porsche', 'Mazda', 'Lincoln'}

Example 2:

范例2:

# Python Set symmetric_difference_update()
##Method with Example
# declaring the sets
x = {"ABC", "PQR", "XYZ"}
y = {"ABC", "PQR", "XYZ"}
z = {"DEF", "MNO", "ABC"}
# printing the results
print("Before calling symmetric_difference_update()...")
print("x:", x)
print("y:", y)
print("z:", z)
# printing the result of
# symmetric_difference_update()
x.symmetric_difference_update(y)
y.symmetric_difference_update(z)
z.symmetric_difference_update(x)
# printing the results
print("After calling symmetric_difference_update()...")
print("x:", x)
print("y:", y)
print("z:", z)

Output

输出量

Before calling symmetric_difference_update()...
x: {'ABC', 'XYZ', 'PQR'}
y: {'ABC', 'XYZ', 'PQR'}
z: {'ABC', 'MNO', 'DEF'}
After calling symmetric_difference_update()...
x: set()y: {'XYZ', 'MNO', 'DEF', 'PQR'}
z: {'ABC', 'MNO', 'DEF'}

翻译自: https://www.includehelp.com/python/set-symmetric_difference_update-method-with-example.aspx

ntp symmetric

ntp symmetric_Python使用示例设置symmetric_difference_update()方法相关推荐

  1. ntp symmetric_Python使用示例设置symmetric_difference()方法

    ntp symmetric 设置symmetric_difference()方法 (Set symmetric_difference() Method) symmetric_difference() ...

  2. python 示例_Python使用示例设置add()方法

    python 示例 设置add()方法 (Set add() Method) add() method is used to add an element to the set, the method ...

  3. kotlin获取属性_Kotlin程序| 属性获取器和设置器方法的示例

    kotlin获取属性 属性获取器和设置器方法 (Properties Getter and Setter Methods) Variable having a class-level scope, d ...

  4. php 的cookie设置时间,php cookie时间设置的方法-PHP问题

    php cookie工夫设置的办法:起首创立一个示例文件:而后输出cookie语句为"setcookie("cookie_name", "abcd", ...

  5. 设置中文linux输入ubuntu,Linux_ubuntu怎么设置成中文?ubuntu中文设置图文方法,  很多朋友安装ubuntu后,发 - phpStudy...

    ubuntu怎么设置成中文?ubuntu中文设置图文方法 很多朋友安装ubuntu后,发现都是英文,看不懂要怎么办?其实ubuntu是可以设置成中文的,下文小编就为大家带来ubuntu中文的设置方法, ...

  6. php 的cookie设置时间,php cookie时间设置的方法

    php cookie时间设置的方法:首先创建一个示例文件:然后输入cookie语句为"setcookie("cookie_name", "abcd", ...

  7. NTP时钟服务器IP地址配置方法(海康大华版)

    NTP时钟服务器IP地址配置方法(海康大华版) 有时候我们去查看录像发现无法正常查到录像并回放录像,排查了硬盘状态和录像计划都是没有问题的,还有什么需要我们去确认下呢? 这个时候我们可以去看下设备时间 ...

  8. php获取时区,php获取当前时间及时区设置的方法详解【附视频】

    本篇文章主要给大家介绍用PHP如何获取当前时间的两种方法和时区设置的方法,以及分别获取昨天和明天的当前时间方法. 下面我们就通过具体的PHP代码示例,来给大家详细解说. 一.通过PHP time函数直 ...

  9. NTP时钟服务器(NTP网络时钟系统)配置说明方法

    NTP时钟服务器(NTP网络时钟系统)配置说明方法 NTP时钟服务器(NTP网络时钟系统)配置说明方法 1. 双击任务栏右下角"时间",打开 [ 时间和日期 属性 ] 设置对话框, ...

最新文章

  1. python开发小型数据库_python数据库编程小应用
  2. 【Redis系列】深入浅出Redis主从复制之哨兵模式【实践】
  3. python opencv立体测距 立体匹配BM算法
  4. 手把手教你写Linux I2C设备驱动
  5. 关于gcc扩展中的宏定义中用 # 和 ##
  6. 我们为什么都应该坚持写博客,意义何在?
  7. HDU 1059 Dividing 多重背包
  8. 博弈论(2)DP/记忆化搜索
  9. windows命令查看端口占用情况
  10. oracle 多实例 端口,Oracle一个实例配置多个listener或多个端口
  11. 如何设置打印机双面打印?
  12. HTML5期末大作业:关于旅游主题网站设计——开心网旅游网页源码(15页) HTML+CSS+JavaScript
  13. python机器人编程——VREP数字孪生四轴机械臂联合仿真
  14. VSCode安装插件,使用本地下载vsix文件
  15. 163邮箱 java发送html邮件,java邮件发送 qq与163邮箱互发和qq和163邮箱发送其余邮箱实例...
  16. 《云计算技术与应用基础》课程标准
  17. Maya模型导入到Unity3d 的秘诀
  18. 2019年安徽省c语言二级答案,2019年春江苏省计算机二级C语言真题
  19. 库存出入库管理业务流程图怎么做?
  20. js元素选择器-js更具name获取元素中的元素

热门文章

  1. Python脚本实现调节Ubuntu/LinuxMint屏幕亮度+色温
  2. 模仿抖音直播商城带货打赏功能做一个app系统
  3. 风力发电变桨距控制系统的研究
  4. 【设计模式】注入处理逻辑,简化代码,避免重复
  5. matlab在数值计算中的应用,详解MATLAB在科学计算中的应用
  6. 互利【思源笔记】订阅码推荐码
  7. JDBC Glean
  8. 【原创】【FS】FATFS文件系统介绍(未完待续........2018.4.1)
  9. wps表格的打印预览显示不全
  10. 武田制药将呈报ICLUSIG(R) (ponatinib) 2期OPTIC试验主要分析的阳性结果,加强填补慢性期CML治疗空白的能力