这篇文章主要为大家详细介绍了python中set的用法:详细源码示例,具有一定的参考价值,可以用来参考一下。

set函数基本用法感兴趣的小伙伴,下面一起跟随512笔记的小编罗X来看看吧。

python代码如下:

# python中set函数基本用法示例(512笔记整理)

class set(object):

"""

set() -> new empty set object

set(iterable) -> new set object

Build an unordered collection of unique elements.

"""

def add(self, *args, **kwargs):

"""添加"""

"""

Add an element to a set.

This has no effect if the element is already present.

"""

pass

def clear(self, *args, **kwargs):

"""清除"""

""" Remove all elements from this set. """

pass

def copy(self, *args, **kwargs):

"""浅拷贝"""

""" Return a shallow copy of a set. """

pass

def difference(self, *args, **kwargs):

"""比较"""

"""

Return the difference of two or more sets as a new set.

(i.e. all elements that are in this set but not the others.)

"""

pass

def difference_update(self, *args, **kwargs):

""" Remove all elements of another set from this set. """

pass

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.

"""

pass

def intersection(self, *args, **kwargs):

"""

Return the intersection of two sets as a new set.

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

"""

pass

def intersection_update(self, *args, **kwargs):

""" Update a set with the intersection of itself and another. """

pass

def isdisjoint(self, *args, **kwargs):

""" Return True if two sets have a null intersection. """

pass

def issubset(self, *args, **kwargs):

""" Report whether another set contains this set. """

pass

def issuperset(self, *args, **kwargs):

""" Report whether this set contains another set. """

pass

def pop(self, *args, **kwargs):

"""

Remove and return an arbitrary set element.

Raises KeyError if the set is empty.

"""

pass

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.

"""

pass

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.)

"""

pass

def symmetric_difference_update(self, *args, **kwargs):

""" Update a set with the symmetric difference of itself and another. """

pass

def union(self, *args, **kwargs):

"""

Return the union of sets as a new set.

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

"""

pass

def update(self, *args, **kwargs):

""" Update a set with the union of itself and others. """

pass

def __and__(self, *args, **kwargs):

""" Return self&value. """

pass

def __contains__(self, y):

""" x.__contains__(y) <==> y in x. """

pass

def __eq__(self, *args, **kwargs):

""" Return self==value. """

pass

def __getattribute__(self, *args, **kwargs):

""" Return getattr(self, name). """

pass

def __ge__(self, *args, **kwargs):

""" Return self>=value. """

pass

def __gt__(self, *args, **kwargs):

""" Return self>value. """

pass

def __iand__(self, *args, **kwargs):

""" Return self&=value. """

pass

def __init__(self, seq=()): # known special case of set.__init__

"""

set() -> new empty set object

set(iterable) -> new set object

Build an unordered collection of unique elements.

# (copied from class doc)

"""

pass

def __ior__(self, *args, **kwargs):

""" Return self|=value. """

pass

def __isub__(self, *args, **kwargs):

""" Return self-=value. """

pass

def __iter__(self, *args, **kwargs):

""" Implement iter(self). """

pass

def __ixor__(self, *args, **kwargs):

""" Return self^=value. """

pass

def __len__(self, *args, **kwargs):

""" Return len(self). """

pass

def __le__(self, *args, **kwargs):

""" Return self<=value. """

pass

def __lt__(self, *args, **kwargs):

""" Return selfsize of S in memory, in bytes """

pass

def __sub__(self, *args, **kwargs):

""" Return self-value. """

pass

def __xor__(self, *args, **kwargs):

""" Return self^value. """

pass

__hash__ = None

# 来自www.512pic.com

注:关于python中set的用法:详细源码示例的内容就先介绍到这里,更多相关文章的可以留意512笔记的其他信息。

关键词:set函数

set在python中的用法_python中set的用法:详细源码示例相关推荐

  1. Python编程:实现词云生成(附详细源码)

    Python编程:实现词云生成(附详细源码) 词云是一种数据可视化的方式,它可以用来展示某个主题下的主要关键词汇.在Python中,我们可以使用 wordcloud 库来实现词云的生成.本文将带您一步 ...

  2. python爬取电子书_python爬取计算机电子书(源码移步github)

    摘要:今年第一个项目,python爬取网络上公开的计算机电子书近8000本,在此基础上简要分析计算机专业的发展变迁.部分整理好的书籍下载链接见文末.代码链接见文末. 计算机诞生以来不到100年,学术的 ...

  3. python 协程库_python 协程库gevent学习--源码学习(一)

    总算还是要来梳理一下这几天深入研究之后学习到的东西了. 这几天一直在看以前跟jd对接的项目写的那个gevent代码.为了查错,基本上深入浅出了一次gevent几个重要部件的实现和其工作的原理. 这里用 ...

  4. python爬取物流信息_python爬虫快递查询系统(源码)

    import requests import json def get_express_type(postid): '''根据快递单号来智能判断快递类型''' url = 'http://www.ku ...

  5. python密码测试代码_python使用正则表达式检测密码强度源码分享

    #encoding=utf-8 #------------------------------------------------------------------------------- # N ...

  6. python算法和数据结构_Python中的数据结构和算法

    python算法和数据结构 To 至 Leonardo da Vinci 达芬奇(Leonardo da Vinci) 介绍 (Introduction) The purpose of this ar ...

  7. python中定义数据结构_Python中的数据结构—简介

    python中定义数据结构 You have multiples algorithms, the steps of which require fetching the smallest value ...

  8. pbp 读取 mysql数据_SqlAlchemy 中操作数据库时session和scoped_session的区别(源码分析)...

    原生session: from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from sqlalch ...

  9. Web 开发中很实用的10个效果【附源码下载】

    在工作中,我们可能会用到各种交互效果.而这些效果在平常翻看文章的时候碰到很多,但是一时半会又想不起来在哪,所以养成知识整理的习惯是很有必要的.这篇文章给大家推荐10个在 Web 开发中很有用的效果,记 ...

最新文章

  1. Ubuntu下非常给力的下载工具–aira2
  2. Swift Tips - 在 Swift 中自定义下标访问
  3. 【NLP傻瓜式教程】手把手带你RCNN文本分类(附代码)
  4. 软件设计期末考试重点内容
  5. u盘排序软件_华硕电脑u盘启动设置
  6. SSM框架知识点复习
  7. java面向对象的三大特征是6_Java面向对象的三大特征
  8. java liste_内功心法 -- java.util.ArrayListE (1)
  9. dj鲜生-15-用户的激活-默认激活置为0-点击链接状态置为1
  10. cf黑机器多久解除_“黑电镀厂”偷排工业废水被捣毁,老板被警方刑拘
  11. Anaconda下安装tensorflow-gpu踩坑日记
  12. python得安什么安装包_初学 Python 需要安装哪些软件?
  13. 安卓自动化测试(2)Robotium环境搭建与新手入门教程
  14. Xray配合awvs漏洞扫描
  15. 2.4GHz/5.8GHz WiFi 天线基础知识
  16. BScroll 使用(Vue)
  17. 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS
  18. 成绩出来了!700 分也上不了清华,究竟该如何从内卷中走出来!肺腑之言,建议转发给亲戚朋友们!
  19. 账号被盗,如何强制下线?
  20. Lenovo windows 解决win键失灵

热门文章

  1. 《播客》项目总结——web标准页面设计方面(转)
  2. scala helloworld
  3. idea 调试远程tomcat
  4. python的标准库学习之__buitin__
  5. 【报告分享】管理者实效管理工具包:用最佳策略和资源留住您最优秀的人才.pdf...
  6. 指针大小为什么与类型无关?
  7. 随机化算法-数值随机化算法
  8. 【问答集锦】减少专家依赖,自动化机器学习如何实现AI普惠?
  9. 年薪201万!华中科大AI博士生入选华为天才少年计划!
  10. 阿里、腾讯 | 算法岗面试复盘