[Tutor] Extract several arrays from a large 2D array

Peter Otten __peter__ at web.de
Thu Jan 21 05:51:10 EST 2016


Alan Gauld wrote:

> So in pseudo code:
> 
> data = {}
> for row in myArray:
>     data.get((row[0],row[1]),[]).append row[3]

Replace get() with setdefault() to go from pseudo to Python code.




More information about the Tutor mailing list