Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to check how many digits string has in python

s = 'some string'

numbers = sum(c.isdigit() for c in s)
letters = sum(c.isalpha() for c in s)
spaces  = sum(c.isspace() for c in s)
others  = len(s) - numbers - letters - spaces
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #digits #string #python
ADD COMMENT
Topic
Name
5+5 =