SciPy

scipy.sparse.dok_matrix.items

dok_matrix.items() → list of D's (key, value) pairs, as 2-tuples