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

  2. How to get a string after a specific substring? - Stack Overflow

    Jul 4, 2021 · How can I get a string after a specific substring? For example, I want to get the string after "world" in my_string="hello python world, I'm a beginner" ...which in this case i...

  3. python - How to substring a string? - Stack Overflow

    Apr 18, 2017 · Extracting substrings: Strings in Python can be subscripted just like an array: s[4] = 'a'. Like in IDL, indices can be specified with slice notation i.e., two indices separated by a …

  4. python - Find string between two substrings - Stack Overflow

    Jul 30, 2010 · How do I find a string between two substrings ('123STRINGabc' -> 'STRING')? My current method is like this:

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

    Python has string.find() and string.rfind() to get the index of a substring in a string. I'm wondering whether there is something like string.find_all() which can return all found indexes (not only the …

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

  7. python - Check if multiple strings exist in another string - Stack …

    1 I found this question from a link from another closed question: Python: How to check a string for substrings from a list? but don't see an explicit solution to that question in the above answers. …

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

  9. python - How to check if a string is a substring of items in a list of ...

    Great, solution. In my case I needed to check if my string (s) had ALL the substrings (xs) from a list (in this case matchers). I just changed any for all and it did the trick: matching = [s for s in …

  10. Substrings of a string using Python - Stack Overflow

    Oct 18, 2012 · Substrings of a string using Python Asked 13 years, 1 month ago Modified 7 years, 2 months ago Viewed 13k times