Python 从给定字符串中提取最大数值

Python 从给定字符串中提取最大数值,python,python-3.x,string,max,re,Python,Python 3.x,String,Max,Re,给定字母数字字符串S,从该字符串中提取最大数值。所有的字母都是小写的。将最大连续数字作为单个数字 输入示例:23dsa43dsa98 预期输出:98 我试过: import re a=input() item=([re.split(r'(\d+)', s) for s in (a)]) print(item) 这将有助于: max(re.findall('\d+', a), key = lambda x: int(x)) 尝试: res = re.findall(r'\d+', a) max

给定字母数字字符串
S
,从该字符串中提取最大数值。所有的字母都是小写的。将最大连续数字作为单个数字

输入示例:
23dsa43dsa98

预期输出:
98

我试过:

import re
a=input()
item=([re.split(r'(\d+)', s) for s in (a)])
print(item)
这将有助于:

max(re.findall('\d+', a), key = lambda x: int(x))
尝试:

res = re.findall(r'\d+', a)
max(list(map(int, res)))