map,filter, reduce, zip都是针对python中的sequence数据类型的内置方法。 一、map map(func, *iterables) 先来看看map函数,接收两个参数,第一个是函数,第二个是序列(可迭代对象),map的作用是将序列中的每一个元素传入函数中,并将返回结果加 ...
分类:
编程语言 时间:
2017-03-30 23:25:43
阅读次数:
256
name="one"''' bin() oct() hex() bytes() ascii() any() all() abs() bool() str() dict() list() callable() 判断能不能被调用,多数用于函数 char() 将ascii码对应的数转为字符 ord() 将 ...
分类:
编程语言 时间:
2017-03-09 20:37:18
阅读次数:
220
1、#快速查看一个类提供了哪些功能 print(dir(dict))2、#打印类详细的说明 help(list) 3、#除法运算获取商和余数,返回元组 divmod() r=divmod(97,10)结果返回元组:(9,7)第一个元素为商,第二个元素为余数 #把商赋给n1,余数赋给n2 n1,n2= ...
分类:
编程语言 时间:
2017-02-27 21:28:08
阅读次数:
210
Helponbuilt-infunctionfilterinmodule__builtin__:filter(...)filter(functionorNone,sequence)->list,tuple,orstringReturnthoseitemsofsequenceforwhichfunction(item)istrue.IffunctionisNone,returntheitemsthataretrue.Ifsequenceisatupleorstring,returnthesametype,..
分类:
编程语言 时间:
2017-02-22 15:33:43
阅读次数:
197
Helponclassfloatinmodule__builtin__:classfloat(object)|float(x)->floatingpointnumber||Convertastringornumbertoafloatingpointnumber,ifpossible.||Methodsdefinedhere:||__abs__(...)|x.__abs__()<==>abs(x)||__add__(...)|x.__add__(y)<==>x+y||__coerc..
分类:
编程语言 时间:
2017-02-22 15:32:55
阅读次数:
236
Helponbuilt-infunctionformatinmodule__builtin__:format(...)format(value[,format_spec])->stringReturnsvalue.__format__(format_spec)format_specdefaultsto""format(value[,format_spec])Convertavaluetoa“formatted”representation,ascontrolledbyformat_spec.Thei..
分类:
编程语言 时间:
2017-02-22 15:29:28
阅读次数:
206
Helponbuilt-infunctiongetattrinmodule__builtin__:getattr(...)getattr(object,name[,default])->valueGetanamedattributefromanobject;getattr(x,‘y‘)isequivalenttox.y.Whenadefaultargumentisgiven,itisreturnedwhentheattributedoesn‘texist;withoutit,anexceptionisr..
分类:
编程语言 时间:
2017-02-22 15:26:56
阅读次数:
184
Helponbuilt-infunctionevalinmodule__builtin__:eval(...)eval(source[,globals[,locals]])->valueEvaluatethesourceinthecontextofglobalsandlocals.ThesourcemaybeastringrepresentingaPythonexpressionoracodeobjectasreturnedbycompile().Theglobalsmustbeadictionarya..
分类:
编程语言 时间:
2017-02-21 20:01:21
阅读次数:
223
Helponclassfileinmodule__builtin__:classfile(object)|file(name[,mode[,buffering]])->fileobject||Openafile.Themodecanbe‘r‘,‘w‘or‘a‘forreading(default),|writingorappending.Thefilewillbecreatedifitdoesn‘texist|whenopenedforwritingorappending;itwillbetruncat..
分类:
编程语言 时间:
2017-02-21 19:57:49
阅读次数:
164