Answers for "python from digits to number"

1

python get numbers from string

string = "abc123"
# Method 1
''.join(char for char in string if char.isdigit())

#Method 2
import re
re.sub("[^0-9]", "", string)
Posted by: Guest on December-03-2020
0

get number of digits in an integer python without converting to string

num = int(input())
count = 0
while num > 0:
  count += 1
  num = num // 10
print(count)
Posted by: Guest on June-28-2021

Code answers related to "python from digits to number"

Python Answers by Framework

Browse Popular Code Answers by Language