SciPy

scipy.sparse.dok_matrix.iteritems

dok_matrix.iteritems() → an iterator over the (key, value) items of D