converting a list into a tuple?

Alex Martelli aleaxit at yahoo.com
Thu May 24 07:13:09 EDT 2001


"Harvest T. Moon" <info at black-karma.de> wrote in message
news:9einj1$306o2$1 at ID-22517.news.dfncis.de...
> how do i convert
>
> mylist = ["foo", "bar"]
>
> into
>
> mytuple = ("foo", "bar")
>
> i think it must be easy ... but ... umm ... :)

Yep, it IS easy indeed, just:

    mytuple = tuple(mylist)


Alex






More information about the Python-list mailing list