[Tutor] Matching zipcode in address file
TGW
galaxywatcher at gmail.com
Mon Apr 5 06:56:23 CEST 2010
> Sorry - my mistake - try:
>
> infile = open("filex")
> match_zips = open("zippys")
> result = [line for line in infile if line in match_zips]
> print result
ok....Thanks...This should do it:
#!/usr/bin/env python
infile = open("filex")
zips = open("zippys")
match_zips = zips.readlines()
results = [line for line in infile if line in match_zips]
print results
More information about the Tutor
mailing list