search between 2 files
Andres Rosado-Sepulveda
arosado at softhome.net
Wed Feb 4 09:01:18 EST 2004
José wrote:
> I'm newby in Python, and I'm working on a script to manage files.
> I have two files, one with a list of domains, and the other with a new
> list of domains. I'd like to know if I have a repeated domain in the
> new's one. I tried opening with readline(), with readlines(), but truly
> I have no idea to countinue.
>
> Have anybody any question?
I think it would be something like this (iow, untested):
domainsFile = file(filename, "rw")
domains = f1.readlines()
newDomainsFile = file(filename2, "r")
for domain in newDomainsFile:
....if not domain in domains:
........domains.append(domain)
--
Andres Rosado
Email: andresr at despammed.com
ICQ: 66750646
AIM: pantear
Homepage: http://andres980.tripod.com/
"Oh boo! Boo hoo! Oh! ... don't stop now ... you motorheads're killin'
me."
-- A surprisingly alive Rattrap, "A Better Mousetrap"
More information about the Python-list
mailing list