求一段字符串里的最长数字串的长度即输出
如
qw234df45654df123456789sfsd
输出 为123456789
长度为 9
s='qw234df45654df123456789sfsd'
#输入混合字符串
# s='1234ab'
print('输入',s)
a=list(s)
beginindex=False
numBegin=0
length=0
Max=0
flag=0
for i in range(len(a)):
if(a[i]>='0'and a[i]<='9'and beginindex==False):
numBegin=i
beginindex = True
elif(a[i]<'0'or a[i]>'9' and beginindex==True):
length=i-numBegin
if(length>Max):
Max=length
flag+=1
beginindex=False
print('输出',Max)