li=[1,2,3,4,5,6,3,2,1] s2 = set(li) print(set(li)) #difference()去除相同项,生成一个新的集合,删除 s3=s2.difference([1,2,3,11]) set1 = {1,44,87,23,55} set2 = {1,44,88,... ...
分类:
编程语言 时间:
2018-05-04 17:10:46
阅读次数:
263
Python之集合 例子:如何想要知道两个列表里是否有相同的,肿么办哩! 集合的作用:关系测试, 交集:两个都有。 差集:在列表a里有,b里没有。 并集:把两个列表的元素合并在一起。并去重 集合的特性: 和字典的大括号一样。{ },但是,他没有value。 天然去重。 集合无序。 交集: 差集: 并 ...
分类:
编程语言 时间:
2018-05-02 11:14:50
阅读次数:
231
问题 J: Frosting on the Cake 题目描述 Iskander the Baker is decorating a huge cake, covering the rectangular surface of the cake with frosting.For this purp ...
分类:
其他好文 时间:
2018-05-02 02:58:51
阅读次数:
204
#集合是无序的list_1 = [1,3,4,5,7,3,6,7,9]list_1 = set(list_1) #集合去重list_2 = set([2,6,0,66,22,8,4])#交集print(list_1.intersection(list_2))#并集print(list_1.union ...
分类:
编程语言 时间:
2018-04-27 19:40:12
阅读次数:
131
关于前几次课的回顾: 开始学习set 关于set的交差并补 ...
分类:
编程语言 时间:
2018-04-22 10:50:10
阅读次数:
163
交集合cat=['fish','beef','pig'] dog=['beef','pig'] #列表转变为集合 cat1=set(cat) dog1=set(dog) print(cat1,dog1) 输出{'pig', 'beef', 'fish'} {'pig', 'beef'} print(... ...
分类:
其他好文 时间:
2018-04-20 23:28:38
阅读次数:
233
union : 对两个结果集进行并集操作,不包括重复行,同时进行默认规则的排序; union all: 对两个结果集进行并集操作,包括重复行,不进行排序; intersect : 对两个结果集进行交集操作,不包括重复行,同时进行默认规则的排序; minus : 对两个结果集进行差操作,不包括重复行, ...
分类:
其他好文 时间:
2018-04-16 14:36:25
阅读次数:
142
【题目描述】 Write a program to find the node at which the intersection of two singly linked lists begins. Notice: If the two linked lists have no intersect ...
分类:
其他好文 时间:
2018-04-15 23:27:33
阅读次数:
223
给定两个数组,写一个方法来计算它们的交集。例如:给定 nums1 = [1, 2, 2, 1], nums2 = [2, 2], 返回 [2, 2].注意: 输出结果中每个元素出现的次数,应与元素在两个数组中出现的次数一致。 我们可以不考虑输出结果的顺序。跟进: 如果给定的数组已经排好序呢?你将如何 ...
分类:
编程语言 时间:
2018-04-15 11:52:18
阅读次数:
197
threshold:阈值分割 minGray<=g<=maxGray select_shape:选取特定区域(Region) regiongrowing:区域生长法分割图像获得region regiongrowing(Image : Regions : Row, Column, Tolerance, ...
分类:
其他好文 时间:
2018-04-08 22:37:57
阅读次数:
242