Python除了List、Tuple、Dict等常用数据类型外,还有一种数据类型叫做集合(set),集合的最大特点是:集合里边的元素是不可重复的并且集合内的元素还是无序的,所以一般情况下集合常用的两个场景是:1.去重(如:列表去重);2.关系测试(如:取交集、取并集、取差集等) 1)集合包含一组无序 ...
分类:
编程语言 时间:
2017-07-05 21:08:21
阅读次数:
228
Notification是智能手机应用开发中常用的信息传递机制,它不用消耗更多资源去不停的检查信息状态,可以非常好的节省资源。 在iOS中分为两种通知:本地、远程。本地的UILocalNotification由全局的NotificationManager统一管理,我们只需要将本地通知对象添加到系统的 ...
分类:
编程语言 时间:
2017-07-05 13:45:03
阅读次数:
212
列表生成式 列表生成式即List Comprehensions,是Python内置的非常简单却强大的可以用来创建list的生成式。 当我们需要创建的list比较复杂,可以使用该方式。 格式如下:L1=[自定义表达式 for x in L2 判断语句 ] 其中,L2可以是list集合,dict集合等形 ...
分类:
编程语言 时间:
2017-07-05 13:19:14
阅读次数:
170
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such p ...
分类:
其他好文 时间:
2017-07-05 11:31:40
阅读次数:
150
实例方法: type(A) #out:type A.__dict__ #out: a = A() #out:{} 类方法:@classmethod a = A() a.getdata() #out: 目的:写一个跟类交互,不跟实例交互的方法 静态方法: TODO:调用静态方法加self与不加self ...
分类:
编程语言 时间:
2017-07-04 23:27:25
阅读次数:
437
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For ...
分类:
其他好文 时间:
2017-07-04 20:26:36
阅读次数:
133
IL基本指令 语法糖汇总using是try-finnally、.Dispose()的语法糖foreach是using、.MoveNext()、 .Current的语法糖 对比分析foreach Vs forforeach 内部有版本检测,默认调用Dispose() 集合线性(唯一的前驱和后驱)直接存... ...
类的相关知识 定义教师类: class Teacher: school = '偶的博爱' # (egon_obj,'egon',18) def __init__(self, name, age): self.name = name # egon_obj.name='egon' #egon_obj._ ...
分类:
其他好文 时间:
2017-07-04 18:13:39
阅读次数:
151
list,tuple,dict和set 1.list集合 list是一种可变的,有序的集合,可以随时添加和删除其中的元素。 其格式如下:list-name=[element1,element2,....] >>> nums = ['1', '2', '3']>>> nums['1', '2', '3 ...
分类:
编程语言 时间:
2017-07-04 13:26:52
阅读次数:
203