How convert all list/tuple...

Andy McKay amckay at merlintechnologies.com
Mon Jun 10 16:44:11 EDT 2002


On 10/06/02 20:31 +0000, Marco Stagno wrote:
> Hi
> There is a fast way to convert all item in a tuple/list into a string type,
> without do a loop?

Im not sure if you mean without looping through every element but should do:

>>> z = [1,2,'string']
>>> [str(x) for x in z]
['1', '2', 'string']

Cheers
-- 
  Andy McKay
  Merlin Technologies





More information about the Python-list mailing list