How to identify the float s in Python programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to identify the float s in Python programming

9th Jun 2019, 5:37 AM
Divyesh
Divyesh - avatar
3 Answers
+ 6
Check if a variable is of type float: f = 25.8 print(isinstance(f, float)) # True Extract float from string: import re float_pattern = re.compile(r'(\d+.\d+)') s = '25.8 is a float' print(float_pattern.search(s).group(0)) # '25.8'
9th Jun 2019, 6:27 AM
Anna
Anna - avatar
+ 3
Can you more elaborate your question?
9th Jun 2019, 5:39 AM
Deepak Kumar
Deepak Kumar - avatar
0
Explain...
9th Jun 2019, 5:58 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar