I'm just getting back into python and was wondering if there is an easy way to return the number of integers that exist in a given string.
For example if I had a list,
['1 5','2 10 23','214 33 1']
iterating through each item in the list and finding the number of integers would return 2
, 3
, and 3
, respectively.
The only thing I can think of would be to have a 2-dimensional list, where each item in the main list is another list that holds the separate numbers, and then I could call len() on each secondary list. Is there an easier way?