Dear all, I am having trouble joining elements in a list into 1 element. e.g. ['a','b','c'] into ['abc'] so that len(list) returns 1
I have tried the following: myList = ['a','b','c'] print myList >>>['a', 'b', 'c'] # get type print type(myList) >>><type 'list'> # get length print len(myList) >>>3 myList2 = ''.join(myList) print myList2 >>>abc # get type print type(myList2) >>><type 'str'> # get length print len(myList2) >>>3 As you can see, the type 'list' turns into 'str' after .join. Doing something like list(''.join(myList)) returns the type 'list' but still has 3 elements. thanks, Dimitri -- --- You can't have everything. Where would you put it? -- Steven Wright --- please visit www.serpia.org
-- http://mail.python.org/mailman/listinfo/python-list