How can I check if a Unicode string contains only numeric characters in Python?

Python Methods and Functions

If we want to check if a Unicode string contains only numeric characters, we can use the special isnumeric () method, which exists exclusively for checking Unicode strings. You can use it like this &






Example

 print (u "1234" .isnumeric ()) print (u "1, a234" .isnumeric ()) 



Output

 True False 







Tutorials