Stringify a list
news at myNOSPAM.org
Wed May 16 06:01:03 EDT 2001
I'm not quite sure how to best solve your problem without "contortions"
if your list is a mix of numbers and strings. Its doable, but you'll need a
while/for loop, I think, and that qualifies as a contortion, I suspose. :)
Now, if you change your logic such that a string representation of '2'
is inserted into the list, its easy.
x = ['2', '6', 'A', '8', 'J']
print ", ".join(x)
"Todd A. Jacobs" <nospam at codegnome.org> wrote in message
news:mailman.990003323.2806.python-list at python.org...
> 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
> [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
More information about the Python-list