About 150,000 results
Open links in new tab
  1. 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:

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

  3. What is the most efficient string concatenation method in Python ...

    Is there an efficient mass string concatenation method in Python (like StringBuilder in C# or StringBuffer in Java)? I found following methods here: Simple concatenation using + Using a …

  4. python - String formatting: % vs. .format vs. f-string literal - Stack ...

    To answer your second question, string formatting happens at the same time as any other operation - when the string formatting expression is evaluated. And Python, not being a lazy …

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

    More broadly, this is true for all Python string methods that change a string's content, e.g. replace, strip, translate, lower / upper, join,... You must assign their output to something if you want to …

  6. How do I append one string to another in Python?

    Dec 14, 2010 · For handling multiple strings in a list, see How to concatenate (join) items in a list to a single string. See How do I put a variable’s value inside a string (interpolate it into the …

  7. python - Call method from string - Stack Overflow

    If I have a Python class, and would like to call a function from it depending on a variable, how would I do so? I imagined following could do it: class CallMe: # Class def App(): # Method one ...

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

    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' …

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

  10. string methods in python - Stack Overflow

    May 7, 2025 · I need help on how to define and test three functions on strings. Following these guidelines. This is review for my exam on Wednesday and would really like to have the correct …