Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from _future_ import print_function
- import sys
- current_word = None
- word_count = 0
- for line in sys.stdin:
- word, counts = line.split("\t".1)
- counts = int(counts)
- if word == current_word:
- word_count += cpunts
- else:
- if current_word:
- print(current_word, word_count, sep="\t")
- current_world = word
- word_count = counts
- if current_word:
- print(current_word,word_count, sep="\t")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement