multipleSpaces = re.compile(u'\\ h+')
importantTextSt ring = '\n \n \n \t\t '
importantTextSt ring = multipleSpaces. sub("M", importantTextSt ring)
I would have expected consecutive spaces and tabs to be replaced by M
but nothing is being replaced. If I try the following, then I'm left
only with M, as expected -
multipleSpaces = re.compile(u'\\ s+') # both vertical and horizontal
importantTextSt ring = '\n \n \n \t\t '
importantTextSt ring = multipleSpaces. sub("M", importantTextSt ring)
What I eventually wish to do is have only single spaces in my text and
to only have single carriage returns -
" one two three four
five
six
"
becoming -
"one two three four
five
six
"
Thanks,
Barry