需要在inpu下面的第一行表格中输入exctra的最后一个单词

2024-04-20 01:04:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要使用Python2.7输出下面的输入数据

enter image description here

enter image description here


Tags: 数据
1条回答
网友
1楼 · 发布于 2024-04-20 01:04:54

这应该适合您:

import re
your_string = "reth10.890"
number = re.findall("\d+\.\d+", your_string)
requested_string = re.sub(number[0], '', a)
print(requested_string)
>>>'reth'

如果字符串包含更多浮点数,则必须选择数字中的最后一个浮点数

相关问题 更多 >