从 Python 中的字符串打印特定切片

Print Specific slice from string in Python

给定下面的字符串,仅打印“数字”字样的最有效方法是什么。即一、二、三,在 python?

中每个字符串的末尾

TT001AKP0000X000100one SS004AKP0000X000100两个 PP05AST0000X00010三 ...

我会在这里使用正则表达式方法:

inp = ["TT001AKP0000X000100one", "SS004AKP0000X000100two", "PP05AST0000X00010three"]
nums = [re.sub(r'^.*\d+', '', x) for x in inp]
print(nums)  # ['one', 'two', 'three']