About 60 results
Open links in new tab
  1. What's the difference between str.isdigit (), isnumeric () and ...

    52 The Python documentation notes the difference between the three methods. str.isdigit Return true if all characters in the string are digits and there is at least one character, false otherwise. Digits …

  2. python - How do I check if a string represents a number (float or int ...

    How do I check if a string represents a numeric value in Python? def is_number(s): try: float(s) return True except ValueError: return False The above works, but it...

  3. python - Why isn't isnumeric working? - Stack Overflow

    Apr 20, 2014 · if using python 3 wrap string around str as shown below str ('hello').isnumeric () This way it behaving as expected

  4. How can I check if string input is a number? - Stack Overflow

    How do I check if a user's string input is a number (e.g., -1, 0, 1, etc.)? user_input = input ("Enter something:") if type (user_input) == int: print ("Is a number") else:

  5. how to find if any character in a string is a number in python ...

    Mar 9, 2022 · I need to determine if there are alphabetic and numeric characters in a string. My code for testing the alphabetic one seems to work fine, but numeric is only working if all of the characters are a...

  6. python - Testing if a value is numeric - Stack Overflow

    Jul 25, 2015 · How can we write a test that checks if a value is numeric, and throw an exception is the value is not numeric? Do we need regular expressions in this case? Thanks.

  7. What is a reliable isnumeric () function for python 3?

    I am attempting to do what should be very simple and check to see if a value in an Entry field is a valid and real number. The str.isnumeric() method does not account for "-" negative numbers, or "."

  8. Python: is isalnum () the same as isalpha with isdigit?

    Jun 11, 2016 · From the documentation of Python 3: str.isalnum() Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. A character c is …

  9. Python: how do I use isnumeric () - Stack Overflow

    Mar 7, 2019 · Can someone kindly explain why the following throws an exception? And what should I do with variable s to find out whether it contains a number? s = str(10) if s.isnumeric(): print s When I read

  10. How to check elements in list "are" numbers in Python?

    Dec 15, 2016 · How to check elements in list "are" numbers in Python? Asked 9 years, 1 month ago Modified 9 years, 1 month ago Viewed 1k times