[Tutor] Unzipping a list
Alan Gauld
alan.gauld at btinternet.com
Tue Jul 8 17:53:04 CEST 2008
"Faheem" <faheem at atlantiscomputing.com> wrote
> If anyone is interested I found this while googling
>
> answers= ['ask'.'tell','repeat','sell']
>
> def unzip(answers):
> unzipped = "".join(answers) # if all items are strings
> unzipped = ", ".join(map(str, answers))
> unzipped = " ".join(str(v) for v in answers if v > 0)
> return unzipped
>
> will give the following
>
> ask tell repeat sell
But in this particular case so would
' '.join(answers)
wouldn't it?
Alan G.
More information about the Tutor
mailing list