[Tutor] List intersect

Nathan Sandver nsandver at gmail.com
Mon Sep 27 19:25:22 CEST 2004


On Mon, 27 Sep 2004 13:12:47 -0400, Asif Iqbal
<iqbala-python at qwestip.net> wrote:
> Hi All
> 
> I never wrote a python script. I am looking for a script that I can use
> to generate a uniq list out of five lists. These lists are bunch of
> usernames. So one list might look like this
> 
> list1:
> 
> usera
> auser
> userb
> buser
> 
> list2:
> userc
> cuser
> userd
> duser
> usera
> 
> Generated list:
> usera
> auser
> userb
> buser
> userc
> cuser
> userd
> duser
> 
> Thanks for any help

Unless I'm mistaken about what you're trying to do, writing a Python
script sounds like making things harder than necessary. Assuming
you're on a Unix-like system and your lists are in separate files:

cat list1 list2 list3 list4 list5 | uniq > newlist

should do what you're after.

-- 
Nathan Sandver, KC7SQK


More information about the Tutor mailing list