Determining whether the string only python3 digital (isdigit () method, isnumeric () method)

Isdigit () method
- detecting whether a string consisting only of numbers

  grammar:

       1 str.isdigit ()

  parameter:

      • no

  return value:

      If the string contains only a number, the return True, otherwise False.

  Example:

      The following example shows an example isdigit () method:

1 str = '123456'
2 print(str.isdigit())    #True
3 
4 str = "耿雨飞"
5 print(str.isdigit())    #False

 

Guess you like

Origin www.cnblogs.com/gengyufei/p/11325451.html