Answers for "python string of numberto 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
1

convert string to number python

>>> x = "23"
>>> y = "20"
>>> z = int(x) - int(y)
>>> z
3
Posted by: Guest on March-13-2021

Code answers related to "python string of numberto number"

Python Answers by Framework

Browse Popular Code Answers by Language