Skip to content

Instantly share code, notes, and snippets.

@masayang
Created March 9, 2013 01:19
Show Gist options
  • Save masayang/5121985 to your computer and use it in GitHub Desktop.
Save masayang/5121985 to your computer and use it in GitHub Desktop.
LongValueSumを指定したMapper
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# 標準入力から読み込む
for line in sys.stdin:
# strip()を呼び出して余分な空白や改行コードを取り除く
line = line.strip()
# split()を呼び出して、単語ごとに分ける
words = line.split()
# 各単語に対して
for word in words:
# '単語[tab]1'というデータを標準出力に送る
print 'LongValueSum:%s\t%s' % (word, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment