03 2016 档案

摘要:1、字典创建 zip函数创建 dict.formkeys创建字典 fromkeys(iterable, value=None, /) method of builtins.type instance Returns a new dict with keys from iterable and val 阅读全文
posted @ 2016-03-12 11:42 hb91 阅读(2996) 评论(0) 推荐(0)
摘要:1、 S.partition(sep) -> (head, sep, tail) Search for the separator sep in S, and return the part before it, the separator itself, and the part after it 阅读全文
posted @ 2016-03-11 21:39 hb91 阅读(534) 评论(0) 推荐(0)
摘要:maketrans 和 translate的用法(配合使用) 下面是python的英文用法解释 maketrans(x, y=None, z=None, /) Return a translation table usable for str.translate(). If there is onl 阅读全文
posted @ 2016-03-11 20:44 hb91 阅读(452) 评论(0) 推荐(0)
摘要:1、S.isdecimal() -> bool Return True if there are only decimal characters in S, False otherwise. 字符串如果是十进制,返回True。 2、S.isdigit() -> bool Return True if 阅读全文
posted @ 2016-03-11 17:11 hb91 阅读(546) 评论(0) 推荐(0)
摘要:python3 字符串属性 1 >>> a='hello world' 2 >>> dir(a) 3 ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__ 阅读全文
posted @ 2016-03-10 22:41 hb91 阅读(2633) 评论(0) 推荐(0)
摘要:版本:python2.7.6 lambda filter() map() reduce() 三点:输入,作用,输出 1、lambda lambda 参数:表达式 返回值为表达式的值 1 >>> f=lambda x,y:x*y 2 >>> f(4,6) 3 24 参数匿名 1 >>> L=[lamb 阅读全文
posted @ 2016-03-06 10:54 hb91 阅读(216) 评论(0) 推荐(0)
摘要:版本:一般用python2.7.6 python3.4.3会标注 1、不可变对象(整数、字符串)通过对象引用进行传递,在函数内部不可改变。 1 >>> def f(a): 2 ... a=100 3 ... 4 >>> b=88 5 >>> f(b) 6 >>> b 7 88 2、可变对象(列表、字 阅读全文
posted @ 2016-03-05 21:34 hb91 阅读(854) 评论(0) 推荐(0)