您的列表元素是字符串。您需要对其进行转换,
float以避免按字典顺序进行比较(按字母顺序,一次只比较一个字符,这
'100' < '2'是因为
1 <2)
numrow = [float(x) for x in row]print('The maximun is:', max(numrow))print('The minimum is:', min(numrow))除非您实际上想要字符串,否则不要创建新列表,而只需传递
key=float给您的
max()函数即可:
max(numrow, key=float)



