queries = open(sys.argv[1],"rU")
tweets = open(sys.argv[2],"rU")
for query in queries:
for tweet in tweets:
query_words = query.split()
tweet_words = tweet.split()
for qword in query_words:
for tword in tweet_words:
#Comparison
I'm trying to use python to iterate over two files with multiple lines in each of them. What I want to do is, to break down each line in both files into words, and then compare each word in the current line in the "query" file with each word in the current line in the "tweet" file. The above is what I did till now, but it's only working for the first line in the query file and skips over the rest of the lines in it. It does work for each line in the tweet file. Any help?
Edit for the duplicate_comment: I understand that after iterating over the queries file it the file handle will be positioned at EOF. But I don't get why it isn't processing the next line in the queries file, and just going directly to EOF.