About 111,000 results
Open links in new tab
  1. python - Remove all whitespace in a string - Stack Overflow

    Oct 1, 2016 · All string characters are unicode literal in Python 3; as a consequence, since str.split() splits on all white space characters, that means it splits on unicode white space …

  2. python - How do I trim whitespace? - Stack Overflow

    Is there a Python function that will trim whitespace (spaces and tabs) from a string? So that given input " \t example string\t " becomes "example string".

  3. Is there a simple way to remove multiple spaces in a string?

    Oct 10, 2009 · 65 Using regexes with "\s" and doing simple string.split ()'s will also remove other whitespace - like newlines, carriage returns, tabs. Unless this is desired, to only do multiple …

  4. python - How to remove leading and trailing spaces from a string ...

    May 4, 2012 · 5 Should be noted that strip() method would trim any leading and trailing whitespace characters from the string (if there is no passed-in argument). If you want to trim …

  5. python - How to strip all whitespace from string - Stack Overflow

    The string module in python contains some common string operations and constants. string.whitespace is a constant which returns a string containing all ASCII characters that are …

  6. How do I remove whitespace from the end of a string in Python?

    Plus, rstrip in the docs doesn't show up easily in a Google search for this problem (using the criteria 'python strip end of string').

  7. How do I remove leading whitespace in Python? - Stack Overflow

    I have a text string that starts with a number of spaces, varying between 2 & 4. What is the simplest way to remove the leading whitespace? (ie. remove everything before a certain …

  8. string - Strip spaces/tabs/newlines - python - Stack Overflow

    I am trying to remove all spaces/tabs/newlines in python 2.7 on Linux. I wrote this, that should do the job: myString="I want to Remove all white \\t spaces, new lines \\n and tabs \\t" myString =

  9. Remove all special characters, punctuation and spaces from string

    I need to remove all special characters, punctuation and spaces from a string so that I only have letters and numbers.

  10. Removing non-breaking spaces from strings using Python

    14 I hesitate before adding another answer to an old question, but since Python3 counts a Unicode "non-break space" character as a whitespace character, and since strings are …