Skip to content

Instantly share code, notes, and snippets.

@prajwal-stha
Created April 9, 2019 13:03
Show Gist options
  • Save prajwal-stha/b980cb4dbedad8967adc0201271730cd to your computer and use it in GitHub Desktop.
Save prajwal-stha/b980cb4dbedad8967adc0201271730cd to your computer and use it in GitHub Desktop.
Mapper File
#!/usr/bin/python
import sys
# Word Count Example
# input comes from standard input STDIN
for line in sys.stdin:
# remove leading and trailing whitespaces
line = line.strip()
# split the line into words and returns as a list
words = line.split()
for word in words:
# write the results to standard output STDOUT
# Emit the word
print'%s\t%s' % (word, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment