题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
http://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
正则表达式yyds
import re while True: try: str1 = input() pattern = re.compile(r'\d+') str_list = pattern.findall(str1) max_long = max([len(i) for i in str_list]) number_list = [] for i in str_list: if len(i) == max_long: number_list.append(i) print(''.join(number_list)+','+str(max_long)) except: break