Re: Array programming

2005-05-07 Thread Sakesun Roykiattisak
V.C.Sekhar wrote:

Hi there,
   I couldnt get to do the following task using Python. Can some pls 
suggest me a way to do this.

I have an array with duplicate strings filled in it. Now am looking for 
a way to extract only the DISTINCT Values from that array.

Could some one pls help me out.

Thanks in advance,
Sekhar


  


try use set or frozenset, if you use python2.4
or try sets.Set or sets.ImmutableSet, if you use python2.3

  import sets
  s = sets.Set([1,1,2,3,2,4])
  for x in s: print x
1
2
3
4

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


RE: Array programming

2005-05-07 Thread Vijay Chandra Sekhar Parepalli
Thank you, Sakesun. 


-Original Message-
From: Sakesun Roykiattisak
[mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 07, 2005 12:17 PM
To: V.C.Sekhar
Cc: python-list@python.org
Subject: Re: Array programming

V.C.Sekhar wrote:

Hi there,
   I couldnt get to do the following task using
Python. Can some pls 
suggest me a way to do this.

I have an array with duplicate strings filled in it.
Now am looking for 
a way to extract only the DISTINCT Values from that
array.

Could some one pls help me out.

Thanks in advance,
Sekhar


  


try use set or frozenset, if you use python2.4
or try sets.Set or sets.ImmutableSet, if you use
python2.3

  import sets
  s = sets.Set([1,1,2,3,2,4])
  for x in s: print x
1
2
3
4





__ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search. 
http://info.mail.yahoo.com/mail_250
-- 
http://mail.python.org/mailman/listinfo/python-list