About 172,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 characters.

  2. python - How to replace multiple substrings of a string ... - Stack ...

    I would like to use the .replace function to replace multiple strings. I currently have string.replace("condition1", "") but would like to have something like string.replace("condition1", "").

  3. How do I get a substring of a string in Python? - Stack Overflow

    Aug 31, 2016 · And just for completeness, Java is like Python in that the String.substring () method takes start and one-past-end. This one just bit me hard, I had assumed it was length like every other …

  4. string - strip () vs lstrip () vs rstrip () in Python - Stack Overflow

    That is, the string provided as an argument is considered as a set of characters, not as a substring. lstrip and rstrip work the same way, except that lstrip only removes characters on the left (at the …

  5. How to use string.replace () in python 3.x - Stack Overflow

    Feb 26, 2012 · The string.replace() is deprecated on python 3.x. What is the new way of doing this?

  6. Does Python have a string 'contains' substring method?

    Aug 9, 2010 · 571 Does Python have a string contains substring method? 99% of use cases will be covered using the keyword, in, which returns True or False:

  7. python - how to find whether a string is contained in another string ...

    str.find() and str.index() are nearly identical. the biggest difference is that when a string is not found, str.index() throws an error, like the one you got, while str.find() returns -1 as others' have posted. …

  8. How to find all occurrences of a substring? - Stack Overflow

    Follow-up: How to find all occurrences of a substring in a string while ignore some characters in Python?

  9. string - What's the difference between str.isdigit (), isnumeric () and ...

    52 The Python documentation notes the difference between the three methods. str.isdigit Return true if all characters in the string are digits and there is at least one character, false otherwise. Digits …

  10. Can you call multiple methods on one line? - Stack Overflow

    Mar 2, 2015 · result = text.lower().replace(string.punctuation, ' ').split(' ') With great python comes great responsibility: don't abuse this feature! The canonical maximum line length codified in PEP 8 is 80 …