I have a string -XX--XXX--XX- I'm trying to count each X and append it afterward. The above string should eventually be [2, 3, 2]. Here is a snippet of what I came up with:
knots = '-XX-XXX-XX-'
#Converting above string to ['XX', 'XXX', 'XX']
knots_without_dashes = knots.split('-')
For each 'X' in my list ['XX', 'XXX' and 'XX'] I want to count until the comma and append the result in an empty list without using counter library.
[2, 3, 2]? Might want to edit the question! Otherwise my answer is not correct.