About 222,000 results
Open links in new tab
  1. How do I get a substring of a string in Python? - Stack Overflow

    Aug 31, 2016 · 28 Is there a way to substring a string in Python, to get a new string from the 3rd character to the end of the string? Maybe like myString[2:end]? Yes, this actually works if you assign, …

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

    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 · 5 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 colon. This …

  4. python - How do I remove a substring from the end of a string …

    926 strip doesn't mean "remove this substring". x.strip(y) treats y as a set of characters and strips any characters in that set from both ends of x. On Python 3.9 and newer you can use the removeprefix …

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

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

  7. Python: Is there an equivalent of mid, right, and left from BASIC?

    May 30, 2015 · This would take the first n characters of substring and overwrite the first n characters of string, returning the result in newstring. The same works for right ().

  8. python - How to extract the substring between two markers ... - Stack ...

    Jan 12, 2011 · 12 In python, extracting substring form string can be done using findall method in regular expression (re) module.

  9. Extract substring with regular expression in Python

    Jun 11, 2019 · Extract substring with regular expression in Python [duplicate] Asked 6 years, 6 months ago Modified 6 years, 6 months ago Viewed 19k times

  10. python - How to match a substring in a string, ignoring case - Stack ...

    How to match a substring in a string, ignoring case Asked 14 years, 5 months ago Modified 2 years, 8 months ago Viewed 289k times