there is a line:
1111; CD_COUNTRY_2; DE; DE; Германия; ГЕРМАНИЯ; 523; ; ГЕРМАНИЯ ; ; ; How to remove a space after a character ;
there is a line:
1111; CD_COUNTRY_2; DE; DE; Германия; ГЕРМАНИЯ; 523; ; ГЕРМАНИЯ ; ; ; How to remove a space after a character ;
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
Try this:
import re In [32]: s Out[32]: '1111; CD_COUNTRY_2; DE; DE; Германия; ГЕРМАНИЯ; 523; ; ГЕРМАНИЯ ; ; ; ' In [33]: re.sub('\;\s+',';', s) Out[33]: '1111;CD_COUNTRY_2;DE;DE;Германия;ГЕРМАНИЯ;523;;ГЕРМАНИЯ ;;;' if you also need to get rid of the spaces before ; :
In [37]: re.sub('\s*\;\s*',';', s) Out[37]: '1111;CD_COUNTRY_2;DE;DE;Германия;ГЕРМАНИЯ;523;;ГЕРМАНИЯ;;;' Source: https://ru.stackoverflow.com/questions/580036/
All Articles
re.sub('\;\s+',';', my_string)- remove any number of spaces after;- MaxU