牛客练习赛15A-吉姆的运算式(Python正则表达式瞎搞)

传送门

题意:出现的数字,取最后一个数字即可。

Python正则表达式提取数字

代码:

import re
str = input()
a = re.findall(r'\-*\d+(?:\.\d+)?',str)
print(a[len(a)-1])

posted on 2018-04-13 19:47  Esquecer  阅读(124)  评论(0编辑  收藏  举报

导航