Array programming

Sakesun Roykiattisak sakesun at boonthavorn.com
Sat May 7 02:46:32 EDT 2005


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




More information about the Python-list mailing list