class set(object):
"""
set() -> new empty set object
set(iterable) -> new set object
"""

def add(self, *args, **kwargs): # 添加元素
"""
Add an element to a set,

This has no effect if the element is already present.
"""

def clear(self, *args, **kwargs): # 清除内容
""" Remove all elements from this set. """

def copy(self, *args, **kwargs): # 浅拷贝,只复制地址空间第一层。
""" Return a shallow copy of a set.  """

def difference(self, *args, **kwargs): # A中存在,B中不存在,并将其赋值给新值。
"""
Return the difference of two or more sets as a new set.

"""

def difference_update(self, *args, **kwargs): #  从当前集合中删除和B中相同的元素,并更新自己。
""" Remove all elements of another set from this set."""

def discard(self, *args, **kwargs): # 移除指定元素,不存在不会报错。
"""
Remove an element from a set if it is a member.

If the element is not a member, do nothing. 
"""

def intersection(self, *args, **kwargs): #取交集
"""
Return the intersection of two sets as a new set.

(i.e. all elements that are in both sets.)
"""

def intersection_update(self, *args, **kwargs): # 取交集并更新到A。
""" Update a set with the intersection of itself and another. """

def isdisjoint(self, *args, **kwargs): # real signature unknown
""" Return True if two sets have a null intersection. 如果没有交集,返回True,否则返回False"""

def issubset(self, *args, **kwargs): # A是否是B子序列
""" Report whether another set contains this set."""

def issuperset(self, *args, **kwargs): # A是否是B父序列
""" Report whether this set contains another set."""

def pop(self, *args, **kwargs): # 移除元素
"""
Remove and return an arbitrary set element.
Raises KeyError if the set is empty. 
"""

def remove(self, *args, **kwargs): # 移除指定元素,不存在会报错。
"""
Remove an element from a set; it must be a member.

If the element is not a member, raise a KeyError. 
"""

def symmetric_difference(self, *args, **kwargs): # 对称差集
"""
Return the symmetric difference of two sets as a new set.

(i.e. all elements that are in exactly one of the sets.)
"""

def symmetric_difference_update(self, *args, **kwargs): # 对称差集,并更新到A中
""" Update a set with the symmetric difference of itself and another."""

def union(self, *args, **kwargs): # 并集
"""
Return the union of sets as a new set.

(i.e. all elements that are in either set.)
"""

def update(self, *args, **kwargs): # 更新元素
""" Update a set with the union of itself and others."""

Python之set方法的更多相关文章

  1. Python测试函数的方法之一

    Python测试函数的方法之一 首先介绍简单的try......except尝试运行的放例如下面的图和代码来简单介绍下: 注释:提醒以下代码环境为2.7.x 请3.x以上的同学们老规矩print(把打 ...

  2. 使用python原生的方法实现发送email

    使用python原生的方法实现发送email import smtplib from email.mime.text import MIMEText from email.mime.multipart ...

  3. Python中sorted()方法

    Python中sorted()方法的用法 1.先说一下iterable,中文意思是迭代器. Python的帮助文档中对iterable的解释是:iteralbe指的是能够一次返回它的一个成员的对象.i ...

  4. python类及其方法

    python类及其方法 一.介绍 在 Python 中,面向对象编程主要有两个主题,就是类和类实例类与实例:类与实例相互关联着:类是对象的定义,而实例是"真正的实物",它存放了类中 ...

  5. Python内置方法的时间复杂度(转)

    原文:http://www.orangecube.net/python-time-complexity 本文翻译自Python Wiki本文基于GPL v2协议,转载请保留此协议. 本页面涵盖了Pyt ...

  6. Python LOGGING使用方法

    Python LOGGING使用方法 1. 简介 使用场景 场景 适合使用的方法 在终端输出程序或脚本的使用方法 print 报告一个事件的发生(例如状态的修改) logging.info()或log ...

  7. [Python]读写文件方法

    http://www.cnblogs.com/lovebread/archive/2009/12/24/1631108.html [Python]读写文件方法 http://www.cnblogs.c ...

  8. 转最简便安装python+selenium-webdriver环境方法

    最简便安装python+selenium-webdriver环境方法 from:http://www.easonhan.info/python/2013/12/07/active-python-ins ...

  9. python字符串replace()方法

    python字符串replace()方法 >>> help(str.replace)Help on method_descriptor:replace(...)    S.repla ...

  10. Python中__init__方法介绍

    本文介绍Python中__init__方法的意义.         __init__方法在类的一个对象被建立时,马上运行.这个方法可以用来对你的对象做一些你希望的 初始化 .注意,这个名称的开始和结尾 ...

随机推荐

  1. P2178 [NOI2015]品酒大会

    思路 在后缀树上进行一些操作就好了 后缀树上LCA的maxlen就是两个后缀的LCP的长度了 然后统计每个点作为LCA的次数和最大值.次大值.最小值.次小值 然后就做完了 代码 #include &l ...

  2. (转载)Unity3D所要知道的基础知识体系大纲,可以对照着学习,不定期更新

    本文献给,想踏入3D游戏客户端开发的初学者. 毕业2年,去年开始9月开始转作手机游戏开发,从那时开始到现在一共面的游戏公司12家,其中知名的包括搜狐畅游.掌趣科技.蓝港在线.玩蟹科技.天神互动.乐元素 ...

  3. Linux下SSH远程连接断开后让程序继续运行解决办法

    一.screen安装 yum  install screen   #CentOS安装 sudo apt-get install screen #ubuntu安装 二.screen常用命令 screen ...

  4. HDU 3567 Eight II(八数码 II)

    HDU 3567 Eight II(八数码 II) /65536 K (Java/Others)   Problem Description - 题目描述 Eight-puzzle, which is ...

  5. bug日记之-------java.io.IOException: Server returned HTTP response code: 400 for URL

    报的错误 出事代码 出事原因 解决方案 总结 多看源码, 我上面的实现方式并不好, 如果返回的响应编码为400以下却又不是200的情况下getErrorStream会返回null, 所以具体完美的解决 ...

  6. fabric私密数据学习笔记

    fabric私密数据学习笔记 私密数据分为两部分 一个是真正的key,value,它被存在 peer的私密数据库(private state)中. 另一部分为公共数据,它是真实的私密数据key,val ...

  7. Oracle配置SQL空间操作要点说明

    前面配置PL/SQL直接通过SQL查询SDE空间数据库,网上已有诸多示例, 常见问题如下: ORA-06520: PL/SQL: 加载外部库时出错ORA-06522: Unable to load D ...

  8. java程序可以跨平台运行的原因

    java有虚拟机(JVM),JAVA程序不是直接在电脑上运行的,是在虚拟机上进行的,每个系统平台都是有自己的虚拟机(JVM),所以JAVA语言能跨平台. 1, java代码不是直接运行在CPU上,而是 ...

  9. wordpress-基础插件,常用函数

    一,插件制作 1.首先在plugin文件夹下创建一个php文件,我以制作一个banner插件为例,把以下代码拷贝到php文件中 <?php add_action("init" ...

  10. vue案例todolist备忘录

    项目效果:https://cinderellastory.github.io/todolist/dist/index.html#/ 项目链接:https://github.com/Cinderella ...