I'm hoping someone can help me...
I have two txt files with lines of URls in each, the first is the existing file which has lots of URLs in it that I have stored and the second is a new list of URls that I would like to check against the existing file.
I would like Python to check each line of each file against each other and print out any new links that aren't in the existing file. Hope that makes sense?
Here is my code (I have rewritten it a couple dozen times so I may be well off the mark by now!)
- Code: Select all
filename = raw_input('enter the new file name: ')
f = open(filename, 'r')
e = open('existing.txt', 'r')
for line in f:
url_file = line
for line in e:
url_existing = line
if not url_file in url_existing:
Any help is greatly appreciated!!