[Tutor] Converting a string to a list with each character as an item
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Thu Jan 11 23:22:11 CET 2007
On Thu, 11 Jan 2007, Terry Carroll wrote:
> On Thu, 11 Jan 2007, Amadeo Bellotti wrote:
>
>> does anyone know how to do this? I need it because i want to make a binary
>> coverter
>
>>>> s = "101001100100101"
>>>> l = list(s)
>>>> l
> ['1', '0', '1', '0', '0', '1', '1', '0', '0', '1', '0', '0', '1', '0', '1']
By the way Amadeo, is it really necessary to do the conversion here?
Strings follow the same indexing as lists, and they can also be used in
loops.
More information about the Tutor
mailing list