Set & Frozenset?

Tim Golden mail at timgolden.me.uk
Sun Mar 8 19:30:54 CET 2009


Diez B. Roggisch wrote:
> Hans Larsen schrieb:
>> Could you help me ?
>>             How could I "take" an elemment from a set or a frozenset 
>> .-) ?
>>
>>                     From a string (unicode? Python<3), or from a 
>> tuple,or from a list: Element by index or slice.
>>                     From a dict: by key.
>>                     But what concerning a set or frozenset!
>>
>>          hope somebody can help!
> 
> You iterate over them. If you only want one value, use
> 
> 
> iter(the_set).next()

or the_set.pop ()

TJG



More information about the Python-list mailing list