Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we thin ...
分类:
其他好文 时间:
2016-08-06 00:18:31
阅读次数:
139
# coding=utf-8 from time import time def logged(when): def log(f,*args,**kargs): print("called: function:%s,args:%r,kargs:%r"%(f,args,kargs)) def pre_ ...
分类:
编程语言 时间:
2016-08-05 17:35:44
阅读次数:
263
装饰器: def wrapper(func): if login('kk'): return func def login(user): if user == 'kk': return True else: print "invalid username" def readirct(url): pa ...
分类:
编程语言 时间:
2016-08-05 15:24:46
阅读次数:
129
之前uboot启动第一阶段的最后将指针指向了start_armboot这个函数,这里也是uboot启动的第二阶段的开始并且uboot启动第二阶段大部分是在这个函数中完成的。DECLARE_GLOBAL_DATA_PTR;这个宏在大部分中的文件中都有这个宏,这个宏的实际定义是在include/asm-arm/Global_data.h#def..
分类:
其他好文 时间:
2016-08-05 01:11:54
阅读次数:
172
Any : Scala中,所有类的超类 Any中定义的方法如下: final def ==( that: Any ): Boolean // 与equals意义总是相同,不可重写 final def !=( that: Any ): Boolean // 与equals意义总是相同,不可重写 def ...
分类:
其他好文 时间:
2016-08-05 00:48:49
阅读次数:
109
class Person(object): def __init__(self, name, gender): self.name = name self.gender = gender class Teacher(Person): def __init__(self, name, gender, ...
分类:
编程语言 时间:
2016-08-04 21:04:27
阅读次数:
142
高阶函数可以把其它函数当作函数参数,帮助我们减少代码重复,例如: object FileMatcher { private def fileHere = (new File(".\\file").listFiles()) def fileEnding(query : String) = { for( ...
分类:
其他好文 时间:
2016-08-04 14:50:22
阅读次数:
153
简介: 使用位移法将ip转为number型以及将number型转为ip,使用语言为python2.7 #!/usr/bin/env python # coding:utf-8 def ip2num(ip): ip = [int(x) for x in ip.split('.')] return ip ...
分类:
编程语言 时间:
2016-08-04 11:40:21
阅读次数:
203
先利用爬虫利用百度糯米提供的api来采集北京当天的团购信息,保存为numi.html import xml.etree.ElementTree as ET import osclass Nuomi(): def __init__(self): self.numi=[] def Parse(self, ...
分类:
编程语言 时间:
2016-08-04 07:55:55
阅读次数:
234
定义函数: def func(x,y,z = v,*args,**kwargs): pass 函数可以有多个返回值,通常封装为一个元组返回 函数也是对象,可以做参数传递、返回。 函数参数: 参数没有类型;没有重载,不区分参数名字和个数;多个同名函数时,后一个覆盖前一个; 任意数量的参数:*,** d ...
分类:
编程语言 时间:
2016-08-03 23:50:36
阅读次数:
193