Created
September 6, 2012 04:54
-
-
Save fangpenlin/3651391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
fa = open(sys.argv[1], 'rt') | |
fb = open(sys.argv[2], 'rt') | |
keywords = {} | |
for line in fa.readlines(): | |
keyword = line.strip() | |
keywords[keyword] = 0 | |
for line in fb.readlines(): | |
line = line.strip() | |
for keyword in keywords: | |
if keyword in line: | |
keywords[keyword] += 1 | |
for keyword, value in keywords.iteritems(): | |
print keyword, value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment