[PYTHON] Is this string a decimal?

python



#Beforehand[" ", "\t", "\n", "\v", "\f", "\r"]Delete around
val = "2.71828"
str.isdigit(val.replace(".", "", 1))  # => True

val = "3.1.4.1.5.9"
str.isdigit(val.replace(".", "", 1))  # => False

Delete only one dot and isdigit. Is it okay to do this? Isn't there? I can't find it.

Recommended Posts

Is this string a decimal?
Is this a system trade?
This is a webiopi question
i! i! ← This is a mathematical formula
About February 02, 2020 * This is a Python article.
What is a distribution?
What is a terminal?
What is a hacker?
What is a pointer?
Check if the string is a number in python
About Go error handling * This is a rough article.
Basics of Python learning ~ What is a string literal? ~
Determine if a string is a time with a python regular expression
[Python] Use a string sequence
What is a decision tree?
Python list is not a list
What is a Context Switch?
What is a super user?
What is a system call
[Definition] What is a framework?
What is a callback function?
The image is a slug
What is a python map?
[Golang] Check if a specific character string is included in the character string
[Python] What is a zip function?
[Python] What is a with statement?
Django: Import a class from a string
Create a pandas Dataframe from a string.
A note when gcloud is broken
What is a lexical scope / dynamic scope?
What is a Convolutional Neural Network?
What kind of Kernel is this Kernel?
Determine if the string is formatable
Python-dynamically call a function from a string
Convert a string to an image
Is "destructive method" a Ruby term?
Create a random string in Python