About 50 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 characters.

  2. 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 spaces, I …

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

    Jul 26, 2009 · 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".

  4. 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 considered whitespace.

  5. 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').

  6. How to remove white spaces from a string in Python?

    1 Mind that in python strings are immutable and string replace function returns a string with the replaced value. If you are not executing the statement at the shell but inside a file,

  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 character?) ...

  8. 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 space character (s), …

  9. 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 =

  10. 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.