I want to extract a part of a two-dimensional list (=list of lists) in Python. I use Mathematica a lot, and there it is very convenient to write
matrix[[2;;4,10;;13]]
which would extract the part of the matrix which is between the 2nd and 4th row as well as the 10th and 13th column.
In Python, I just used
[x[firstcolumn:lastcolumn+1] for x in matrix[firstrow:lastrow+1]]
Is there also a more elegant or efficient way to do this?