Stringify a list

Corrado Gioannini gioco at nekhem.com
Wed May 16 05:59:20 EDT 2001


hi,
a simple way to do that is:

from string import join
join(map(str,mylist))

(or: join(map(str,mylist), ', ') )

cheers,
Corrado

On Wed, May 16, 2001 at 01:54:56AM -0700, Todd A. Jacobs wrote:
> I have a list object that contains card values (i.e. 2-10, J, Q, K, A),
> but I can't seem to print the list in such a way that it doesn't appear as
> follows:
> 
> 	[2, 6, 'A', 8, 'J']
> 
> I don't mind the commas, but how do I remove the quotes and brackets
> without going through contortions?
> 
> -- 
> Todd A. Jacobs
> CodeGnome Consulting, LTD
> 
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 

"Thought is only a flash between two long nights, 
                                         but this flash is everything." 
                                                            (H. Poincare')




More information about the Python-list mailing list