代码:
def long_num(str): max_list = [] for i in range(len(str)): new_list = [] for j in range(i+1,len(str)): if str[j].isdigit(): new_list.append(str[j]) else: break if len(max_list) < len(new_list): max_list = new_list return "".join(max_list)
测试:
s = "124241htjrjr797rgrrw1575373573733" print(long_num(s))
结果:
1575373573733