About 50 results
Open links in new tab
  1. 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 …

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

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

    May 4, 2012 · strip([chars]): You can pass in optional characters to strip([chars]) method. Python will look for occurrences of these characters and trim the given string accordingly.

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

    How do I strip all the spaces in a python string? For example, I want a string like strip my spaces to be turned into stripmyspaces, but I cannot seem to accomplish that with strip (): >>> '

  6. Python strip() multiple characters? - Stack Overflow

    Oct 10, 2010 · 10 strip only strips characters from the very front and back of the string. To delete a list of characters, you could use the string's translate method:

  7. 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], [' ...

  8. 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 …

  9. python - Why doesn't calling a string method (such as .replace or ...

    Why doesn't calling a string method (such as .replace or .strip) modify (mutate) the string? Asked 13 years, 11 months ago Modified 1 year, 3 months ago Viewed 108k times

  10. string - .strip not working in python - Stack Overflow

    str.strip() removes characters from the start and end of a string only. From the str.strip() documentation: Return a copy of the string with the leading and trailing characters removed. Emphasis mine. Use …