叨逼叨:
#集合 不可重复的列表 可变类型 #1.添加 无则添加有则不操作 不可重复
# se = {'alex','eric','seven'}
# se.add('qiqi')
# se.add('blex')
# print(se)

举例


 def add(self, *args, **kwargs): # real signature unknown
"""
Add an element to a set. This has no effect if the element is already present.
"""
pass

add

#2.清空
# se = {'alex','eric','seven'}
# se.clear()
# print(se)
#执行结果:
#set()

举例


    def clear(self, *args, **kwargs): # real signature unknown
""" Remove all elements from this set. """
pass

clear

#3.拷贝 浅拷贝
# se = {'alex','eric','qiqi'}
# v = se.copy()
# print(v)

举例


    def copy(self, *args, **kwargs): # real signature unknown
""" Return a shallow copy of a set. """
pass

copy

#4. 找不同
#1> difference 输出 se1中有的,se2中无的 赋值给新的变量
# se1 = {'alex','eric','qiqi','dh'}
# se2 = {'alex','eric','gege','yiyi'}
# v = se1.difference(se2)
# print(v)
#2> difference_update 输出 将se1中有的,se2中无的 重新赋值给se1 (se1会被清空,变成se1中有的,se2中无的值)
# se1 = {'alex','eric','qiqi','dh'}
# se2 = {'alex','eric','gege','yiyi'}
# se1.difference_update(se2)
# print(se1)
#3> symmetric_difference 将两者不同的 赋值给新的变量
# se1 = {'alex','eric','qiqi','dh'}
# se2 = {'alex','eric','gege','yiyi'}
# v = se1.symmetric_difference(se2)
# se1.symmetric_difference_update(se2)#将两者不同的 覆盖赋值给se1
# print(se1)
# print(v)

举例


    def difference(self, *args, **kwargs): # real signature unknown
"""
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

difference

    def difference_update(self, *args, **kwargs): # real signature unknown
""" Remove all elements of another set from this set. """
pass

difference_update

    def symmetric_difference(self, *args, **kwargs): # real signature unknown
"""
Return the symmetric difference of two sets as a new set. (i.e. all elements that are in exactly one of the sets.)
"""
pass

symmetric_difference

    def symmetric_difference_update(self, *args, **kwargs): # real signature unknown
""" Update a set with the symmetric difference of itself and another. """
pass

symmetric_difference_update

#5.交集
# se1 = {'alex','eric','qiqi','dh'}
# se2 = {'alex','eric','gege','yiyi'}
# v = se1.intersection(se2)
# se1.intersection_update(se2) #将交集覆盖赋值给se1
# print(se1)
# print(v)

举例


    def intersection(self, *args, **kwargs): # real signature unknown
"""
Return the intersection of two sets as a new set. (i.e. all elements that are in both sets.)
"""
pass

intersection

    def intersection_update(self, *args, **kwargs): # real signature unknown
""" Update a set with the intersection of itself and another. """
pass

intersection_update

#6.并集
# se1 = {'alex','eric','qiqi','dh'}
# se2 = {'alex','eric','gege','yiyi'}
# v = se1.union(se2)
# print(v)

举例


    def union(self, *args, **kwargs): # real signature unknown
"""
Return the union of sets as a new set. (i.e. all elements that are in either set.)
"""
pass

union

#7.移除
##discard
# se1 = {'alex','eric','qiqi','dh'}
# se1.discard('qiqi')
# print(se1)
##remove
# se1 = {'alex','eric','qiqi','dh'}
# se1.remove('alex')
# print(se1)
##pop
#不会用呢

举例


举例里有疑问

    def discard(self, *args, **kwargs): # real signature unknown
"""
Remove an element from a set if it is a member. If the element is not a member, do nothing.
"""
pass

discard

    def remove(self, *args, **kwargs): # real signature unknown
"""
Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError.
"""
pass

remove

    def pop(self, *args, **kwargs): # real signature unknown
"""
Remove and return an arbitrary set element.
Raises KeyError if the set is empty.
"""
pass

pop

#8. for循环

# s1 = {"alex",'eric','tony','李泉','李泉11'}
# for i in s1:
# print(i) # s1 = {"alex",'eric','tony','李泉','李泉11',(11,22,33)}
# for i in s1:
# print(i)

举例

#9.增加

#解决了疑问再添加

#还剩的功能
# isdisjoint
# issubset
# issuperset ##疑问
pop 貌似和别的不一样呢 不会用了 # se1 = {'alex','eric','qiqi','dh'}
# print(se1)
#打印结果
#{'qiqi', 'eric', 'dh', 'alex'} 和原来的顺序不一样呢 随机的???? # se1 = {'alex','eric','qiqi','dh'}
# se1.update('f')
# print(se1)
#打印结果
#{'f', 'qiqi', 'dh', 'eric', 'alex'} #这个位置也是随机插入吗??? # se1 = {'alex','eric','qiqi','dh'}
# se1.update('abcdef')
# print(se1)
#打印结果
#{'qiqi', 'b', 'e', 'f', 'a', 'eric', 'dh', 'c', 'd', 'alex'} # 是分开增加的,不是作为一个整体增加
#那如何作为一个整体增加呢

set-集合功能介绍的更多相关文章

  1. fedora21发布与新功能介绍(附fedora21安装教程与fedora21下载地址)

    fedora21发布与新功能介绍(附fedora21安装教程与fedora21下载地址) 最新的Fedora 21终于正式发布了,Fedora Server 是一款强大可定制化的操作系统,包括了最好最 ...

  2. HBase的Snapshots功能介绍

    HBase的Snapshots功能介绍 hbase的snapshot功能还是挺有用的,本文翻译自cloudera的一篇博客,希望对想了解snapshot 的朋友有点作用,如果翻译得不好的地方,请查看原 ...

  3. Python中模块之copy的功能介绍

    模块之copy的功能介绍 copy主要分两种: 1.浅拷贝 2.深拷贝 赋值: 在python中赋值算特殊的拷贝,其实赋值可以理解为同一个对象有两个名字,所以当其中一个发生变化,另一个也跟着会变化. ...

  4. Python中def及lambda的功能介绍

    函数def及lambda的功能介绍 1. def函数的功能介绍 1. 函数的参数 无参数函数 格式:def func_name(): '''__doc__'''#函数的说明文档(内容) express ...

  5. Python中set的功能介绍

    Set的功能介绍 1.集合的两种函数(方法) 1. 集合的内置函数 交集 格式:x.__and__(y)等同于x&y 例如:s1 = {'a',1,} s2 = {'b',1,} s3 = { ...

  6. Python中dict的功能介绍

    Dict的功能介绍 1. 字典的两种函数(方法) 1. 字典的内置函数 包含关系 格式:x.__contains__(key)等同于key in x 例如:dic = {'ab':23,'cd':34 ...

  7. Liferay-Activiti 功能介绍 (新版Liferay7基本特性)

    一句话简介 Liferay是世界领先的开源企业门户(也可作为综合门户),是最强大(没有之一)的JAVA开源门户,在Gartner和Forrester和评价非常高,近几年已经超越了微软门户Sharepo ...

  8. Oracle EBS WMS功能介绍(二)

    Oracle EBS WMS功能介绍(二) (版权声明,本人原创或者翻译的文章如需转载,如转载用于个人学习,请注明出处.否则请与本人联系,违者必究) 出货物流逻辑主要包括 1.      打包.能够进 ...

  9. OpenSearch最新功能介绍

    摘要:阿里云开放搜索(OpenSearch)是一款结构化数据搜索托管服务,其能够提供简单.高效.稳定.低成本和可扩展的搜索解决方案.OpenSearch以平台服务化的形式,将专业搜索技术简单化.低门槛 ...

  10. redis常用指令总结以及功能介绍

    第一部分 redis的常用指令 一.针对key的操作 1.1 del key [key .. ]                 , 删除指定的一个或者多个key;1.2 dump key       ...

随机推荐

  1. 如何优雅地实现Python通用多线程/进程并行模块

    当单线程性能不足时,我们通常会使用多线程/多进程去加速运行.而这些代码往往多得令人绝望,需要考虑: 如何创建线程执行的函数? 如何收集结果?若希望结果从子线程返回主线程,则还要使用队列 如何取消执行? ...

  2. PHP初体验

    PHP初体验 提笔写初体验总不知道从何说起,直接聊PHP中的函数.PHP网络技术.数据库操作.PHP模板等感觉又不是初体验.最后还是决定从PHP的面向对象.PHP的魔术方法.PHP的反射.PHP中的异 ...

  3. 你是否也在学习ES6 Promise时遇到过这个问题?

    背景 周末闲来无事,随便翻看了一下阮一峰老师的<ES6 标准入门>第2版,ps:之前在阮一峰老师的官网看过电子版,感觉干货满满,所以就买了纸质版:当看到第16章第4节 'Promise.p ...

  4. Spring 依赖注入之从不会到稍微会一点儿

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  5. ocr智能图文识别 tess4j 图文,验证码识别 分享及所遇到的问题

    自己对tess4j的使用总结 1,tess4j 封装了 tesseract-ocr 的操作 可以用很简洁的几行代码就实现原本tesseract-ocr 复杂的实现逻辑 如果你也想了解tesseract ...

  6. python编写知乎爬虫实践

    爬虫的基本流程 网络爬虫的基本工作流程如下: 首先选取一部分精心挑选的种子URL 将种子URL加入任务队列 从待抓取URL队列中取出待抓取的URL,解析DNS,并且得到主机的ip,并将URL对应的网页 ...

  7. Java模拟http请求调用远程接口工具类

    package ln; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamRea ...

  8. Mac下终端配置(item2 + oh-my-zsh + solarized配色方案)

    最近重装了系统,于是便重新配置了一下终端,使其更符合用户习惯. 效果如下: 拥有语法高亮,命令行tab补全,自动提示符,显示Git仓库状态等功能. 安装 首先我们下载的 iTem2 这个软件,比Mac ...

  9. [1] 插件架构(PLUG-IN)

    网上的一种比较好对插件的定义是:插件(Plug-in,又称addin.add-in.addon或add-on,又译外挂)也称为扩展,是一种遵循一定规范的应用程序接口编写出来的程序,主要是用来扩展软件功 ...

  10. Linux 程序,进程和线程

    进程如何使用内存. 当程序文件运行为进程时, 进程在内存中获得空间. 1) Text : 固定大小 存储指令(instruction), 说明每一步的操作. 2) Global Data : 固定大小 ...