---恢复内容开始---

集合

建立  set() ={},集合没有顺序,由不可改变的数字 ,字符串,元组构成

#交集
print(a&b) #a.intersection(b)

#并集
print(a|b) #a.union(b)#

#差集
print(a-b) #a.difference(b)

#交叉补集
print(a^b) #a.symmetric_difference(b)

元组的方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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): # real signature unknown
        """
        Add an element to a set,添加元素
         
        This has no effect if the element is already present.
        """
        pass
 
    def clear(self*args, **kwargs): # real signature unknown
        """ Remove all elements from this set. 清除内容"""
        pass
 
    def copy(self*args, **kwargs): # real signature unknown
        """ Return a shallow copy of a set. 浅拷贝  """
        pass
 
    def difference(self*args, **kwargs): # real signature unknown
        """
        Return the difference of two or more sets as a new set. A中存在,B中不存在
         
        (i.e. all elements that are in this set but not the others.)
        """
        pass
 
    def difference_update(self*args, **kwargs): # real signature unknown
        """ Remove all elements of another set from this set.  从当前集合中删除和B中相同的元素"""
        pass
 
    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
 
    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
 
    def intersection_update(self*args, **kwargs): # real signature unknown
        """ Update a set with the intersection of itself and another.  取交集并更更新到A中 """
        pass
 
    def isdisjoint(self*args, **kwargs): # real signature unknown
        """ Return True if two sets have a null intersection.  如果没有交集,返回True,否则返回False"""
        pass
 
    def issubset(self*args, **kwargs): # real signature unknown
        """ Report whether another set contains this set.  是否是子序列"""
        pass
 
    def issuperset(self*args, **kwargs): # real signature unknown
        """ Report whether this set contains another set. 是否是父序列"""
        pass
 
    def pop(self*args, **kwargs): # real signature unknown
        """
        Remove and return an arbitrary set element.
        Raises KeyError if the set is empty. 移除元素
        """
        pass
 
    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
 
    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
 
    def symmetric_difference_update(self*args, **kwargs): # real signature unknown
        """ Update a set with the symmetric difference of itself and another. 对称差集,并更新到a中 """
        pass
 
    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
 
    def update(self*args, **kwargs): # real signature unknown
        """ Update a set with the union of itself and others. 更新 """
        pass

python修炼4的更多相关文章

  1. python修炼第一天

    Python修炼第一天 新的开始:不会Python的运维,人生是不完整的. 为了我的人生能够完整,所以我来了!今后跟着太白金星师傅学习功夫,记录一下心得,以便日后苦练. 一 Python的历史: Py ...

  2. Python 修炼1

    2016年11月21日 Python基础修炼第一篇 1.Python是什么?有什么优缺点呢? python是一个高级编程语言. 优点:开发效率比较高,不但有php写网页的功能,还有写后台的功能 缺点: ...

  3. Python修炼10------面向对象

    面向对象-----类 类:类是一种数据结构,就好比一个模型,该模型用来表述一类事物(事物即数据和动作的结合体),用它来生产真实的物体(实例). 对象:什么叫对象:睁开眼,你看到的一切的事物都是一个个的 ...

  4. python修炼6

    文件操作 注:不能把open语句放在try块里,因为当打开文件出现异常时,文件对象file_object无法执行close()方法. 1.打开文件 (相当于桌面的快捷方式)f=open(文件名,模式默 ...

  5. python修炼7----迭代器

    迭代器 -------------------------------------------------------------------------------- 充电小知识 1.yield-- ...

  6. Python 修炼3

    # 列表 功能方法 *补充(zip zip(list1,list2) 会形成一个[(),()]新的列表list1和list2一一对应得组成一个新的元素以元组最为单位) # 1.修改# li = [1, ...

  7. Python 修炼2

    Python开发IDE:Pycharm.elipse 1.运算符 1 1.算数运算 + - * / // ** % 2. 赋值运算 a = 1 a += 2 3.比较运算 1>3 4.逻辑运算 ...

  8. python修炼第七天

    第七天面向对象进阶,面向对象编程理解还是有些难度的,但是我觉得如果弄明白了,要比函数编程过程编程省事多了.继续努力! 1.面向对象补充: 封装 广义上的封装:把变量和函数都放在类中狭义上的封装:把一些 ...

  9. python修炼第六天

    越来越难了....现在啥也不想说了,撸起袖子干. 1 面向对象 先来个例子: 比如人狗大战需要有狗,人所以创建两个类别模子def Person(name,sex,hp,dps): dic = {&qu ...

  10. python修炼第五天

    第五天,感觉开始烧脑了.递归逻辑难,模块数量多,但是绝世武功都是十年磨一剑出来的!稳住! 1 递归. 定义-----递归就是在函数的内部调用自己递归深度 998不建议修改递归深度,因为如果998都没有 ...

随机推荐

  1. Python自动化测试 -ConfigParser模块读写配置文件

    C#之所以容易让人感兴趣,是因为安装完Visual Studio, 就可以很简单的直接写程序了,不需要做如何配置. 对新手来说,这是非常好的“初体验”, 会激发初学者的自信和兴趣. 而有些语言的开发环 ...

  2. 【Linux】Shell学习笔记之四——文件和目录管理(硬连接和软连接)

    在这节将要学习linux的连接档,在之前用"ls -l" 查看文件属性的命令时, 其中第二个属性是连接数.那么这个连接数是干什么的?这就要理解inode. 先说一下文件是怎么存储的 ...

  3. poj 3181 Dollar Dayz(求组成方案的背包+大数)

    可能nyist看见加的背包专题我老去凑热闹,觉得太便宜我了.他们新加的搜索专题居然有密码. 都是兄弟院校嘛!何必那么小气. 回到正题,跟我写的上一篇关于求组成方案的背包思路基本一样,无非就是一个二维费 ...

  4. 工作流--JBPM简介及开发环境搭建

    一. 工作流简介 项目中不断的接触工作流,点点滴滴积累了一些,下面把一些学习到的东西整理记录下来. 工作流一般的适用场景:公文流转.行政审批.订单处理.产品研发.制造过程等.用专业一点的语言来描述工作 ...

  5. 【解惑】剖析float型的内存存储和精度丢失问题

    问题提出:12.0f-11.9f=0.10000038,"减不尽"为什么? 现在我们就详细剖析一下浮点型运算为什么会造成精度丢失? 1.小数的二进制表示问题 首先我们要搞清楚下面两 ...

  6. [Node.js]REPL(交互式解释器)

    摘要 REPL(Read Eval Print Loop:交互式解释器) 表示一个电脑的环境,类似 Window 系统的终端或 Unix/Linux shell,我们可以在终端中输入命令,并接收系统的 ...

  7. Unity中使用协程进行服务端数据验证手段

    近期在做项目中的个人中心的一些事情,用户头像上传,下载,本地缓存,二级缓存,压缩,这些都要做,麻雀虽小五脏俱全啊,也是写的浑浑噩噩的, 当我们在上传用户头像的时候,向服务端发送上传头像请求之前,一般都 ...

  8. Apache的htaccess文件出现500错误的原因

    Apache 我平时很少用到,今天测试环境下碰到个问题,老是500错误莫名其妙 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FI ...

  9. Vs2015 Ef 连接Oracle 出现OracleInternal.Common.ConfigBaseClass 的解决办法

    如果配置没问题的话,就是 Oracle.ManagedDataAccess 在全局程序集的版本问题 解决方法方法 将Oracle.ManagedDataAccess  GAC全局程序集中移除 1:用C ...

  10. cdh 安装记录

    安装文件准备 CDH 下载地址:http://archive.cloudera.com/cdh5/parcels/latest/ 下载操作系统对应的版本: 1.CDH-5.3.0-1.cdh5.3.0 ...