Beginner question: Converting Single-Element tuples to list

vdavidster at gmail.com vdavidster at gmail.com
Mon Jun 27 00:58:11 EDT 2005


Hello everyone,

I want to convert a tuple to a list, and I expected this behavior:

list(('abc','def')) -> ['abc','def']
list(('abc')) -> ['abc']

But Python gave me this behavior:

list(('abc','def')) -> ['abc','def']
list(('abc')) -> ['a','b','c']

How do I do get Python to work like the in former case?

Many thanks!

David




More information about the Python-list mailing list