Hi, I am a new member to this group and relatively to python. I have a list with 4 columns and column1 elements are unique. I wanted to extract unique elements in column3 and and place the other elements of the column along with unique elements in column 4 as a tab delim text.
Table: col1 col2 col3 col4 A Apple 5 Chennai B Baby 11 Delhi I Baby* 1 Delhi M Dasheri+ 5 Mumbai K Apple 12 Copenhagen * -> Baby => Infant + -> Dasheri => Mango for ele in table: col2 = ele.split('\t')[1] col2.append(col2) col2_set = sets.Set(col2) col2_set -> (Apple,Baby Dasheri) Apple A,K 5,12 Chennai, Copenhagen Baby B,I 1,11 Delhi Dasheri M 5 Mumbai. for ele in col1_set: nam = ele.strip() for k in list: m = re.search(nam,k) cols = k.split('\t') a = cols[0] n = cols[2] c = cols[3] print nam+'\t'+a+'\t'+n+'\t'+c A dictionary option does not work beca This isnt working properly. please help me any one question 2: A list with 100 unique items, repeated several times. Apples - repeated 1000 times in list Vegie - repeated 300 times in list how can I get a uniq elements that repeated several times: for item in range(len(list)): for k in range(len(list)): if item == k: if list[item] != k[list]: print item This isnt working either. logic appears correct. looking forward for help pleas. thank you Srini __________________________________ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor