Python之set方法
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方法的更多相关文章
- Python测试函数的方法之一
Python测试函数的方法之一 首先介绍简单的try......except尝试运行的放例如下面的图和代码来简单介绍下: 注释:提醒以下代码环境为2.7.x 请3.x以上的同学们老规矩print(把打 ...
- 使用python原生的方法实现发送email
使用python原生的方法实现发送email import smtplib from email.mime.text import MIMEText from email.mime.multipart ...
- Python中sorted()方法
Python中sorted()方法的用法 1.先说一下iterable,中文意思是迭代器. Python的帮助文档中对iterable的解释是:iteralbe指的是能够一次返回它的一个成员的对象.i ...
- python类及其方法
python类及其方法 一.介绍 在 Python 中,面向对象编程主要有两个主题,就是类和类实例类与实例:类与实例相互关联着:类是对象的定义,而实例是"真正的实物",它存放了类中 ...
- Python内置方法的时间复杂度(转)
原文:http://www.orangecube.net/python-time-complexity 本文翻译自Python Wiki本文基于GPL v2协议,转载请保留此协议. 本页面涵盖了Pyt ...
- Python LOGGING使用方法
Python LOGGING使用方法 1. 简介 使用场景 场景 适合使用的方法 在终端输出程序或脚本的使用方法 print 报告一个事件的发生(例如状态的修改) logging.info()或log ...
- [Python]读写文件方法
http://www.cnblogs.com/lovebread/archive/2009/12/24/1631108.html [Python]读写文件方法 http://www.cnblogs.c ...
- 转最简便安装python+selenium-webdriver环境方法
最简便安装python+selenium-webdriver环境方法 from:http://www.easonhan.info/python/2013/12/07/active-python-ins ...
- python字符串replace()方法
python字符串replace()方法 >>> help(str.replace)Help on method_descriptor:replace(...) S.repla ...
- Python中__init__方法介绍
本文介绍Python中__init__方法的意义. __init__方法在类的一个对象被建立时,马上运行.这个方法可以用来对你的对象做一些你希望的 初始化 .注意,这个名称的开始和结尾 ...
随机推荐
- Python打开新世界的大门-入门篇1
目录 题记 Python技巧.避坑及心得 八种数据类型 循环 函数 Homework 题外话 之前没有写博客的习惯,现在开始写觉得入门也太晚了吧,看看同龄的大哥都写了十几万字.于是 ...
- 解决问题:怎样在页面获取数组和List集合的长度
解决问题:怎样在页面获取数组和List集合的长度 我们在前端遍历后台数据的时候,经常是从后台传过来一个数组或List集合,在前端页面就可以使用JSTL的<c:For each>标签遍历数据 ...
- laravel框架——验证码(第二种方法)
开发环境: laravel5.5 php7.1.11 mysql 一.安装扩展包 ,安装前确认当前环境支持composer(出现如下图所示则安装成功) $ composer require " ...
- 提供HTML5播放RTSP流 提供微信播放RTSP流 HTML5支持rtsp web播放rtsp,微信支持rtsp
首先H5的video不支持RTSP播放,以下是html5的video官方介绍 现在如果要在页面中使用video标签,需要考虑三种情况,支持Ogg Theora或者VP8(如果这玩意儿没出事的话)的(O ...
- python常用技巧
1,关于tab键与4个空格: 由于不同平台间,tab键值设置有所区别,据相关介绍,官方在缩进方面推荐使用4个空格.方便起见,可设置tab自动转换为4个空格. 1.1在pycharm中: 通过fi ...
- JSP介绍
1.JSP简介 JSP全名为Java Server Pages,中文名叫java服务器页面,其根本是一个简化的Servlet设计,它是由Sun Microsystems公司倡导.许多公司参与一起建立的 ...
- 【Mybatis】【3】mybatis Example Criteria like 模糊查询
正文: 在Java中使用Mybatis自动生成的方法,like需要自己写通配符 public List<TableA> query(String name) { Example examp ...
- 【js】【图片瀑布流】js瀑布流显示图片20180315
js实现把图片用瀑布流显示,只需要“jquery-1.11.2.min.js”. js: //瀑布流显示图片 var WaterfallImg = { option: { maxWidth: 850, ...
- 人生苦短,我用python(目录)
一.python基础篇 python中闭包及延时绑定问题 python中的装饰器.生成器 二.前端 bootstrap框架 BOM&DOM JavaScript中的词法分析 三.数据库 mys ...
- CodeIgniter框架解析
转载于:https://www.cnblogs.com/xiaoxiaoqingyi/p/6901654.html 转载仅为以后自己学习. 业余花了点时间看看CodeIgniter框架(简称CI),C ...