我们知道,一个典型的Map-Reduce过程包 括:Input->Map->Partition->Reduce->Output。Partition负责把Map任务输出的中间结果 按key分发给不同的Reduce任务进行处理。Hadoop 提供了一个很有用的partitioner类KeyFieldBa...
分类:
编程语言 时间:
2014-06-18 17:00:55
阅读次数:
332
如果在某个函数中包含了yield, 这意味着这个函数已经是一个Generator, 它的执行 会和其他普通的函数有很多不同。比如: def h(): print 'To be brave' yield 5 h()可以看到,调用h()之后,print语句并没有执行, 这就是yi...
分类:
编程语言 时间:
2014-06-18 16:40:47
阅读次数:
235
1- 多行注释 ''' ''' 或 """ """'''this is the standard way to include a multiple-line comment in you code'''"""this is the standard way to include a multipl...
分类:
编程语言 时间:
2014-06-18 15:46:56
阅读次数:
264
1、生成动态链接库[root@typhoeus79 c]# more head.c #include #include typedef struct _point{ int x; int y;}Point;Point * InitPoint(int x,int y){ Point ...
分类:
编程语言 时间:
2014-06-18 15:45:00
阅读次数:
267
Python中使用MySQL的方法具体可见:http://www.w3cschool.cc/python/python-mysql.html需要注意的是编码问题:要在多个地方设置为UTF8,具体可见:http://drizzlewalk.blog.51cto.com/2203401/448874同时...
分类:
数据库 时间:
2014-06-18 15:02:28
阅读次数:
245
使用urllib2模块构造http post数据结构,提交有文件的表单(multipart/form-data),本示例提交的post表单带有两个参数及一张图片,代码如下:#buld post body data boundary = '----------%s' % hex(int(...
分类:
编程语言 时间:
2014-06-18 14:55:59
阅读次数:
283
静态内部类如果你不需要内部类对象与其外围类对象之间有联系,那你可以将内部类声明为static。这通常称为嵌套类(nested class)。Static Nested Class是被声明为静态(static)的内部类,它可以不依赖于外部类实例被实例化。而通常的内部类需要在外部类实例化后才能实例化。想...
分类:
其他好文 时间:
2014-06-18 14:39:52
阅读次数:
321
argv是在脚本内部使用,旨在接受命令传参比如,一个脚本argv.py,代码里面有,sys.argv[1],,sys.argv[2],那么运行这个脚本时,必须在后面跟两个参数,用空格隔开,如:python argv.py hello world 示例如下:首先编辑脚本 argv.py#coding:...
分类:
其他好文 时间:
2014-06-18 14:35:13
阅读次数:
191
转载自:http://hi.baidu.com/????_xu/blog/item/5b9650c513bd3f049d163d8b.htmlpython的set和其他语言类似, 是一个 基本功能包括关系测试和消除重复元素. 集合对象还支持union(联合),intersection(交), dif...
分类:
编程语言 时间:
2014-06-18 14:30:05
阅读次数:
243
1、reportlab:由很多部分组成且允许用户使用多种方法创建输出,地址:下载ReportLabhttps://pypi.python.org/simple/reportlab/http://www.reportlab.com/software/opensource/rl-toolkit/down...
分类:
编程语言 时间:
2014-06-18 14:22:27
阅读次数:
313