What is the best way to validate an input as a currency (without any currency symbols)
My valid inputs can be only in the form of 40 or 40.12
What is the best way to validate an input as a currency (without any
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How about simply using
format()and try/except for wrong values?Note that it simply cuts any number behind the second number behind the decimal point.
You should be more specific by showing us more examples with your desired behaviour.