This should give you some info on what is being passed to the only_digit function and what's being returned.
d=['72olle' ,'103doo', '100ya']
def only_digit (data):
print(type(data)," => ",data)
theReturn = ''.join(filter(lambda x: x.isdigit(),(i for i in data)))
print(type(theReturn)," => ",theReturn)
return theReturn
for i in d:
print(only_digit(i))
print(only_digit(i for i in d))
Output:
>>> for i in d:
... print(only_digit(i))
...
<type 'str'> => ' 72olle '
<type 'str'> => ' 72 '
72
<type 'str'> => ' 103doo '
<type 'str'> => ' 103 '
103
<type 'str'> => ' 100ya '
<type 'str'> => ' 100 '
100
>>> print(only_digit(i for i in d))
<type 'generator'> => ' <generator object <genexpr> at 0x0000000001F764C8> '
<type 'str'> => ' '