第8题: Discover the largest product of five consecutive digits in the 1000-digit number. s = '指定数字串' print max( [ eval('*'.join(s[i:i+5])) for i in xrange(len(s)-5) ] 这个算法个人认为没有优化的必要,在s串不是很长,或连续数字不是很多的情况下.