ff = open('../base_exp.txt', 'r') lis = ff.readlines() ff.close() from math import log10 maxx = [0, 0] for i in xrange(len(lis)): tmp = lis[i].split(',') base = int(tmp[0]) power = int(tmp[1]) loga = power * log10(base) if loga > maxx[0]: maxx = [loga, i + 1] print maxx