Set & Frozenset?

Diez B. Roggisch deets at nospam.web.de
Sun Mar 8 19:06:58 CET 2009


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()

Diez



More information about the Python-list mailing list