converting a list into a tuple?

Martin Franklin martin.franklin at westerngeco.com
Thu May 24 06:30:26 EDT 2001


"Harvest T. Moon" wrote:

> how do i convert
>
> mylist = ["foo", "bar"]
>
> into
>
> mytuple = ("foo", "bar")
>
> i think it must be easy ... but ... umm ... :)
>
> Harvest T. Moon
> -- a life less ordinary!!

try:

mytuple=tuple(mylist)

Thanks

Martin.




More information about the Python-list mailing list