I have a phrase like this:
a='Hello I have 4 ducks'
and I apply str.split
to this, so I now I have
>>> a.split()
['Hello','I','have','4','ducks'].
the problem is that every a.split()[i]
is a string, but I need the program to recognize that the 4 is an integer. I need this to know which position the first integer is in, so I do this:
if(isinstance(a[i], float) or isinstance(a[i], int)):
punt=k
but every a[i]
is a string.
Can I do something that makes my program recognize the integers inside this list?