List Splitting
Brendon Towle
btowle at carnegielearning.com
Mon Aug 21 15:38:24 EDT 2006
Not the most elegant solution, perhaps, but:
>>>t = [ "a", "b", "c", "n", "a", "a", "t", "t", "t" ]
>>>outlist = []
>>>for x in range(3):
... temp=[]
... for y in range(len(t)/3):
... temp.append(t[3*y+x])
... outlist.append(temp)
>>>outlist
[['a', 'n', 't'], ['b', 'a', 't'], ['c', 'a', 't']]
--
Brendon Towle, PhD
Cognitive Scientist
+1-412-690-2442x127
Carnegie Learning, Inc.
The Cognitive Tutor Company ®
Helping over 375,000 students in 1000 school districts succeed in math.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060821/d6aa0d76/attachment.html>
More information about the Python-list
mailing list