import re def findDimensions(text): return tuple([ float(n) for n in re.sub('[^0-9,.]', ' ', text ).replace(',', '.').split()]) Testando: import re def findDimensions(text): return tuple([ float(n) for n in re.sub('[^0-9,.]', ' ', text ).replace(',', '.').split()]) print(findDimensions("14,5 x 55 x 22,0")) print(findDimensions("14,5 x 55cm x 22")) print(findDimensions("14,5cm x 55 x 22cm")) print(findDimensions("14,5cmx55x22cm")) print(findDimensions("14,5 cmx55 cmx22 cm")) print(findDimensions("14,5 cm x 55.0 x 22.3 cm")) Saída: (14.5, 55.0, 22.0) (14.5, 55.0, 22.0) (14.5, 55.0, 22.0) (14.5, 55.0, 22.0) (14.5, 55.0, 22.0) (14.5, 55.0, 22.0) Veja a expressão regular funcionano no [regex101.com](https://regex101.com/r/bFywrT/5). Veja o código de teste rodando no [Ideone.com](https://ideone.com/lERoFT)