class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ #print(len(matrix))#行数 #print(matrix[0]) #print(len(matrix[0]))#列数 for i in range(len(matrix)): #print(matrix[i]) if target in matrix[i]: return True else: i+=1 else: return False
原文:https://www.cnblogs.com/taoyuxin/p/11607709.html