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

    Aug 31, 2016 · @PhilHibbs "Like every other substring function" is rather too strong a statement, since there are at least two other common ways to interpret substring arguments. One is (start, …

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

  3. How to extract a substring from a string in Python 3

    Jan 27, 2021 · I am trying to pull a substring out of a function result, but I'm having trouble figuring out the best way to strip the necessary string out using Python. Output Example: [<THIS …

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

    Jul 4, 2021 · def substring_after(s, delim): return s.partition(delim)[2] s1="hello python world, I'm a beginner" substring_after(s1, "world") # ", I'm a beginner" IMHO, this solution is more readable …

  5. python - substring of an entire column in pandas dataframe

    Apr 8, 2016 · I have a pandas dataframe "df". In this dataframe I have multiple columns, one of which I have to substring. Lets say the column name is "col". I can run a "for" loop like below …

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

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

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

    May 30, 2015 · These work great for reading left / right "n" characters from a string, but, at least with BBC BASIC, the LEFT$() and RIGHT$() functions allowed you to change the left / right …

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

  9. python - How to extract the substring between two markers

    Jan 12, 2011 · also, you can find all combinations in the bellow function. s = 'Part 1. Part 2. Part 3 then more text' def find_all_places(text,word): word_places = [] i=0 while True: word_place = …

  10. python find substrings based on a delimiter - Stack Overflow

    Sep 15, 2013 · I am new to Python, so I might be missing something simple. I am given an example: string = "The , world , is , a , happy , place " I have to create substrings separated by …

Refresh