I have the following code but it's returning the digits individually. How to return an exact number that is contained in the string?
def hashnumbers(inputString):
return [char for char in inputString if char.isdigit()]
print(hashnumbers("super 24 string 4"))
For the above program, I am getting the output like below:
['2', '4', '4']
and I am expecting something like below:
['24', '4']