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. CSS scroll-behavior和JS scrollIntoView让页面滚动平滑

    转自 https://www.zhangxinxu.com/wordpress/2018/10/scroll-behavior-scrollintoview-%E5%B9%B3%E6%BB%91%E6 ...

  2. 在单机Docker上安装 Traefik 反向代理-负载均衡器

    一.创建Traefik和容器应用的连接网络 sudo docker network create traefik-net 二.下载Traefik样本配置文件wget https://raw.githu ...

  3. efk学习整理

    概念 Logstash 数据收集处理引擎.支持动态的从各种数据源搜集数据,并对数据进行过滤.分析.丰富.统一格式等操作,然后存储以供后续使用. kibana 可视化化平台.它能够搜索.展示存储在 El ...

  4. [python]目录及文件操作

    Python OS模块和shutil模块 获取路径 # 获取当前路径 pwd = os.getcwd() # 获取上级路径 a_pwd = os.path.abspath(os.path.dirnam ...

  5. [Linux]安装node.js

    node.js安装 安装node.js的版本控制工具nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/ins ...

  6. PowerDesigner设置Oracle不区分大小写

    一. powerdesigner设置当前数据库 打开powerdesigner,然后选择菜单DatabaseChange current DBMS,如图: 修改这个下拉框的值即可. 二. power ...

  7. 如何为Rails作贡献:例增加rich_text field generators

    如何为Rails作贡献 例增加rich_text field generators 下载https://github.com/rails/rails 打开atom,在 rails/railties/l ...

  8. 在Mac os 10.11 下编译Berkeley caffe

    安装各种补丁和组件,缺啥装啥. python 采用 2.7.13 最新版. 安装工具  homebrew , pip 很繁琐,但是没难度. 由于本人macbook pro不支持CUDA,所以不用安装. ...

  9. 小程序 新建项目底部tabbar

    在app.json中配置 { "pages": [ "pages/index/index", "pages/staging/staging" ...

  10. ZJOI2019Day2AFO记

    题目读下来感觉,,,怎么看上去模型都这么简单全是套路题的样子.先想了下T3应该会50,是个计算几何,50够了..于是先写了40(10分等下再来写)这样就花掉了一个小时.....过去看T1,直接高斯消元 ...