[Tutor] Matrix

Shi Mu samrobertsmith at gmail.com
Tue Oct 25 06:26:26 CEST 2005


I can not understand the use of "cell in row" for two times in the code:

# convert the matrix to a 1D list
matrix = [[13,2,3,4,5],[0,10,6,0,0],[7,0,0,0,9]]
items = [cell for row in matrix for cell in row]
print items


More information about the Tutor mailing list