On Sat, 17 May 2008 15:49:05 +1000, Beema shafreen <[EMAIL PROTECTED]> wrote:

Hi all,
I need to find the intersection of 10 different files with ids defined as
a_items, b_items and so on

common_items = a_items&b_items&c_items&\
               d_items&e_items&f_items\
               &g_items&h_items&i_items&j_items

i have included above line in the script
is this an right way will my program accept it or what are the other option
to compare 10 different such items

See "Set Types", http://docs.python.org/lib/types-set.html.  Example:

s1 = set([1,2,3])
s2 = set([3,4,5])
s1 & s2
set([3])

You can populate your sets using an iterable, such as the lines from a file. Example:

s1 = set(file(r'blah.txt'))

--
Kam-Hung Soh <a href="http://kamhungsoh.com/blog";>Software Salariman</a>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to