The task is to return all numbers in a string, excluding all letters. My current is such as:
def get_digits(cs: str) -> str:
str1 = ''
for c in cs:
if c.isdigit():
a = str1.join(c)
return a
For example, when get_digits("a1b2c3") is entered, the desired output is 123. Currently the returned result is '3'. Any help would be much appreciated. Thank you