On 7/13/2011 2:13 PM Ellerbee, Edward said...
I've been beating my head against the desk trying to figure out a method
to accomplish this:


<snip>

#-----------------------------------------------------------------
My intent is to have the end data come out (from the example list above)
in the format of
25220[56]
25224[678]

this should get you started...

>>> list1=['252205','252246','252206','252247','252248']
>>> D = {}
>>> for ii in list1: D.setdefault(ii[:5],[]).append(ii[5])
...
>>> print D
{'25224': ['6', '7', '8'], '25220': ['5', '6']}
>>>

Emile

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to