break up a value in a list to a list of individual items

Arnaud Delobelle arnodel at googlemail.com
Sun Nov 9 06:21:05 EST 2008


r3bol <leon.san.email at gmail.com> writes:

> Hi, sorry to post this, but I've had a really hard time finding how to
> do it.
> Q.
> How can I break up a value in a list to a list of individual items
> (preferably without importing any modules)?
> Like...
> ['12345'] (string)
> to
> [1, 2, 3, 4, 5] [numbers]

Here's one way:

>>> map(int, '12345')
[1, 2, 3, 4, 5]

HTH

-- 
Arnaud



More information about the Python-list mailing list