need advice on strings ?

I have a txt file with like 1000 lines like this

AL AlabamaALANNISTON METROPOLITAN AP 94 154 134 124 119 105

and I need to transform this into another line with comas and save it into another file line per line

also how to detect space or Tab on existing lines in file ?

“AL , AlabamaALANNISTON METROPOLITAN AP , 94, 15 ,41, 34, 12 ,41 ,19 ,105”

can someone help to do the conversion using strings commands

note: I could find index of first number then anything on the left could be move to another new text line

then split all the numbers !

```

for i in range (0,len1):

print (‘1 =’,i,’ T =’, l1[i], ’ alpha =’, l1[i].isalpha() , ’ space =’,l1[i].isspace() )

if l1[i].isdigit() and indexnum ==0 :
indexnum = i
l2 =l1[0:indexnum]

str.rindex(sub[, start[, end]])

print (‘index first number =’, indexnum)
print (‘l2 =’,l2)



thanks
happy bl

I tried using re
but loosing the first number with re.split

is there a way not to loose it ?

sep = ‘[0-9]’
head = re.split(sep,l3,1)[0]
head2 = re.split(sep,l3,1)[1]

thanks
happy bl