About 50 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 strip method - Stack Overflow

    Feb 1, 2013 · You are misunderstanding what .strip() does. It removes any of the characters found in the string you pass. From the str.strip() documentation: The chars argument is a string specifying the set …

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

    Oct 8, 2015 · 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 …

  4. python - What does s.strip () do exactly? - Stack Overflow

    Dec 9, 2012 · 2 As we know s.strip() function returns a string in which leading and trailing spaces are removed or striped but if we use strip () function with a argument like-

  5. String.strip() in Python - Stack Overflow

    Without strip (), bananas is present in the dictionary but with an empty string as value. With strip (), this code will throw an exception because it strips the tab of the banana line.

  6. Strip in Python - Stack Overflow

    Sep 24, 2012 · I have a question regarding strip() in Python. I am trying to strip a semi-colon from a string, I know how to do this when the semi-colon is at the end of the string, but how would I do it if it …

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

    How to use text strip () function? Asked 8 years, 9 months ago Modified 8 years, 9 months ago Viewed 21k times

  8. python - Strip / trim all strings of a dataframe - Stack Overflow

    Cleaning the values of a multitype data frame in python/pandas, I want to trim the strings. I am currently doing it in two instructions : import pandas as pd df = pd.DataFrame([[' a ', 10], [' ...

  9. python - Why doesn't .strip () remove whitespaces? - Stack Overflow

    strip doesn't change the original string since strings are immutable. Also, instead of string1.strip(' '), use string1.replace(' ', '') and set a return value to the new string or just return it.

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

    Oct 1, 2016 · 3 In the following script we import the regular expression module which we use to substitute one space or more with a single space. This ensures that the inner extra spaces are …