【发布时间】:2019-11-10 08:55:50
【问题描述】:
让用户输入为0207a97,使用re 207从列表中提取而不是0207
str = input()
l = [int(i) for i in re.findall('\d+',str) if '9' not in i]
if len(l)>0:
print(max(l))
【问题讨论】:
-
int构造函数的常规行为:int("0297") --> 297