Replacement in the line of double space for a single
📁 строка, python, работа
I have a line:
str = 'a l a m a k o t a ' as can be seen in the line, between the letters of the same word I have one gap, between the words two. Class = ""> 'Ala ma kota'
I tried to decide, but crashed:
I used to change double gaps to '`' ':
for i in range ( len ( str )- 1 ): if str [i] == '' and str [i+ 1 ] == '' : comment.replace ( 'str [i]' , '' ') comment.Replace (' 'str [i + 1]' , '`' ') Then I remove the single:
str . CroupLace ( '' , '' ) and at the end I replace '`' 'with a gap:
str . Class = ""> '' `'' , '' ') pre> But this whole design does not work. How can this problem solve?