About 165,000 results
Open links in new tab
  1. string - strip () vs lstrip () vs rstrip () in Python - Stack Overflow

    lstrip, rstrip and strip remove characters from the left, right and both ends of a string respectively. By default they remove whitespace characters (space, tabs, linebreaks, etc)

  2. python - Remove all whitespace in a string - Stack Overflow

    Oct 1, 2016 · I want to eliminate all the whitespace from a string, on both ends, and in between words. I have this Python code: def my_handle(self): sentence = ' hello apple ' sentence.strip() But that

  3. Difference between String trim () and strip () methods

    The String.strip (), String.stripLeading (), and String.stripTrailing () methods trim white space [as determined by Character.isWhiteSpace ()] off either the front, back, or both front and back of the …

  4. Is there a better way to use strip() on a list of strings? - python

    Aug 29, 2012 · list = map(str.strip, list) This will apply the function str.strip to every element in list, return a new list, and store the result back in list.

  5. python - How to use text strip () function? - Stack Overflow

    3 Just to add a few examples to Jim's answer, according to .strip() docs: Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of …

  6. list - how to use strip () in python - Stack Overflow

    Oct 8, 2015 · 3 Pointers: strip returns a new string, so you need to assign that to something. (better yet, just use a list comprehension) Iterating over a file object gives you lines, not words; so instead you …

  7. Python strip with \n - Stack Overflow

    Feb 19, 2012 · 37 The strip() method removes whitespace by default, so there is no need to call it with parameters like '\t' or '\n'. However, strings in Python are immutable and can't be modified, i.e. the …

  8. python - How can I remove a trailing newline? - Stack Overflow

    The canonical way to strip end-of-line (EOL) characters is to use the string rstrip () method removing any trailing \r or \n. Here are examples for Mac, Windows, and Unix EOL characters.

  9. trim - String strip () for JavaScript? - Stack Overflow

    How do I strip leading and trailing spaces from a string? For example, " dog " should become "dog".

  10. c++ - How to config cmake for strip file - Stack Overflow

    Better -DCMAKE_C_FLAGS_RELEASE if you want to strip only release build. But this might be dangerous if cmake build overwrites flags instead of adding to them (regular case for custom builds).