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. JavaWeb网上商城项目中用户注册,使用MailServer和FoxMail搭建本地邮件服务器

    下载并安装易邮邮件服务器MailServer和腾讯邮箱FoxMail,下载地址  https://download.csdn.net/download/checkerror2/10130538 具体步 ...

  2. vue引入JQ的方法

    在vue中引入jq 用vue-cli脚手架工具构建项目成功后 当需要引入JQ,可用以下方法: 1.首先在package.json里的 dependencies加入"jquery" ...

  3. vue文档阅读笔记——计算属性和侦听器

    页面链接:https://cn.vuejs.org/v2/guide/computed.html 注意点 计算属性用于 替代模板内的表达式. 如果计算属性所依赖的属性未更新,会返回自身的缓存. 侦听器 ...

  4. docker容器的时间同步

    好久没写博客了,有时间开始陆续整理一下工作中遇到的问题,今天罗列一下docker容器的时间同步问题 我们每次在run容器的时候,会存在时区不同的问题,这样对数据处理会有很大障碍,操作如下: 第一种方式 ...

  5. java @FunctionalInterface

    public class Worker { private String doWork(String job) { return "Job " + job + " don ...

  6. 转载&修改:赶集mysql军规

    个人认为以下军规主要为了适应海量数据场景,对于业务复杂性系统并一定完全按照此军规   一,核心军规 不在数据库做计算,cpu计算务必移至业务层 控制单表数据量,单表记录控制在千万级 控制列数量,字段数 ...

  7. ranch 源码分析(完)

    接上 ranch 源码分析(三) 在上一次,根据ranch源码把大概流程理了一遍,下面我们将一些细节解释一下. ranch只是一个服务的框架,它提供了传输层协议代码(ranch_tcp 和ranch_ ...

  8. 浅谈BFC的理解

    在 web 页面布局中,有三种控制元素版式布局的模型: 普通流 (Flow) 元素在 HTML 中按照先后位置从上至下的流式排列方式布局. 浮动流(Float) 在浮动布局中,元素首先按照普通流的位置 ...

  9. 跟踪mqttv3源码(二)

    对于spring-mqtt.xml中的标签: <int-mqtt:message-driven-channel-adapter> <int-mqtt:outbound-channel ...

  10. C/C++与C#之间类型的对应

    最近在研究pos打印机相关功能, 调用winapi以及跨进程通信等,都涉及到类型之间的转换. C/C++ C# HANDLE, LPDWORD, LPVOID, void* IntPtr LPCTST ...