[Tutor] sorting into lists

Tim Wilson wilson@visi.com
Fri, 20 Sep 2002 22:37:29 -0500


Hey everyone,

Let's say I've got a list like the following:

l = [1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4]

I'm trying to figure out a good way to turn this list into

[[1, 1, 1], [2, 2], [3, 3, 3, 3], [4, 4]]

Any ideas?

-Tim

-- 
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com