What is MapReduce and Why
Processing Pattern
Hadoop
Algorithms in MapReduce
Tutorial
#!/usr/bin/env python
import sys
#--- get all lines from stdin ---
for line in sys.stdin:
#--- remove leading and trailing whitespace ---
line = line.strip()
#--- split the line into words ---
words = line.split()
#--- output tuples [word, 1] in tab-delimited format ---
for word in words:
print '%s\t%s' % (word,"1")
Remove leading and trailing whitespace #删除前导和尾随空格