Aaron Misquith <aaronmisqu...@gmail.com> Wrote in message:
> As two others have said, a set is the simplest solution to avoid duplicates. 

There are other questions to ask, however.   Primary is whether
 order matters.

If it does not, then observe that list(set(mylist)) will produce a
 list from a list without duplicates. 

If order does matter, then I ask whether there was some constraint
 that forced you to do it 3 lines.

If not, I would suggest that you write the output one line at a
 time,  after checking each line against a set. If the line is not
 in the set, add it to the set and write it to the file.
 

And watch out for newlines.  What happens if one or both input
 files are missing their final newlines?



-- 
DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to