loop over list and process into groups

Paul Rubin no.email at nospam.invalid
Fri Mar 5 04:45:54 EST 2010


lbolla <lbolla at gmail.com> writes:
> for k, g in groupby(clean_up(data) , key=lambda s: s.startswith('VLAN')):
> 	if k:
> 		key = list(g)[0].replace('VLAN','')

This is the nicest solution, I think.  Mine was more cumbersome.



More information about the Python-list mailing list