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. bzoj1452 [JSOI2009]Count ——二维树状数组

    中文题面,给你一个矩阵,每一个格子有数字,有两种操作. 1. 把i行j列的值更改 2. 询问两个角坐标分别为(x1,y1) (x2,y2)的矩形内有几个值为z的点. 这一题的特点就是给出的z的数据范围 ...

  2. PHP——laravel之DB类->查询

    DB类之查询: 满足条件的全部获取:DB::table("表名")->where("name",">","1" ...

  3. Cow Cycling 动态规划

    1552: Cow Cycling 时间限制(普通/Java):1000MS/10000MS     内存限制:65536KByte总提交: 39            测试通过:20 描述 The ...

  4. 悲观并发 乐观并发 Entity Framework Core中的并发处理

    悲观并发策略 A用户发起一个请求   开启了事务 查询到了某一条数据 进行修改     在A提交事务之前 其他人都不能对这条数据进行修改 这种策略最常见的一个问题就是死锁  比如A修改X记录,B修改Y ...

  5. Jquery封装的Ajax

    $.get方法 语法: $.get(url,data,function(e){ //e就是服务器返回的数据 },dataType); 四个参数: url: 请求的服务器地址 data: 发送给服务器的 ...

  6. CentOS7.5下安装、配置MySql数据库 --CentOS7.5

    1.下载MySql的rpm包 [root@VM_39_157_centos -]# wget http://repo.mysql.com/mysql-community-release-el7-5.n ...

  7. centos7安装python,mariaDB,django,nginx

    0,安装centos7 centos默认不开启网卡,需要在安装时将ens33设置为on,或者后续通过vi ifcfg-ens33,找到onboot,设置为yes ssg登陆centos7时,如果提示W ...

  8. Confluence 6 针对合并完全失败的内容重新运行合并

    如果在系统合并的时候有任何内容的合并失败的话,一个 Confluence 的管理员可以再次重新启动内容合并(请参考前面页面的内容).只有内容还是使用 wiki 格式的才会被合并,因此重新合并所需要的时 ...

  9. Linux基础命令mkdir

    mkdir  /home/ceshi   home目录下创建测试目录 mkdir  -p  /home/ceshi1/ceshi home目录下递归创建 mkdir     /home/ceshi2  ...

  10. 关于lower_bound( )和upper_bound( )的常见用法

    lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的. 在从小到大的排序数组中, lower_bound( begin,end,num):从数 ...