A
A
Alexander2018-11-09 22:25:18
Python
Alexander, 2018-11-09 22:25:18

How to extract all float values ​​from text using regular expressions?

Hello!
There is such a text "blah blah 1.2334 blah blah 1.3467 blah blah"
How to extract all floating point numbers from it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2018-11-09
@sanya84

>>> import re
>>> a = 'бла бла 1.2334 бла бла 1.3467 бла бла '
>>> re.findall('\d+\.\d+', a)
['1.2334', '1.3467']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question