2
Supposing I have a string: str = ' p s i c ó l o g o '
. Note that the string has a space before the letters, a space between the letters and a space after the letters. What I want is for the spaces between the letters to disappear, but the space that is before and what is after the letters remains. The string would look like this: str = ' psicólogo '
. I even tried the str.replace(" ", "")
but this would also eliminate the spaces that are before and after the letters, so: 'psicólogo'
Could you explain why I voted no? This solution works.
– Augusto Vasques