equal
deleted
inserted
replaced
179 |
179 |
180 # Update the result for the next iteration |
180 # Update the result for the next iteration |
181 result = tmpresult |
181 result = tmpresult |
182 |
182 |
183 return result |
183 return result |
|
184 |
|
185 def groupby(target, group_key): |
|
186 """Groups a list of dictionaries by group_key. |
|
187 """ |
|
188 |
|
189 result = {} |
|
190 |
|
191 for value in target: |
|
192 key_value = value[group_key] |
|
193 |
|
194 if not key_value in result: |
|
195 result[key_value] = [] |
|
196 |
|
197 result[key_value].append(value) |
|
198 |
|
199 return result |