About 50 results
Open links in new tab
  1. Split a string by a delimiter in Python - Stack Overflow

    To split on whitespace, see How do I split a string into a list of words?. To extract everything before the first delimiter, see Splitting on first occurrence. To extract everything before the last delimiter, see …

  2. Split string with multiple delimiters in Python - Stack Overflow

    return re.split(regex_pattern, string, maxsplit) If you're going to split often using the same delimiters, compile your regular expression beforehand like described and use RegexObject.split. If you'd like to …

  3. In Python, how do I split a string and keep the separators?

    This is an answer for Python split () without removing the delimiter, so not exactly what the original post asks but the other question was closed as a duplicate for this one.

  4. How can I split by 1 or more occurrences of a delimiter in Python?

    If you want to split by 1 or more occurrences of a delimiter and don't want to just count on the default split() with no parameters happening to match your use case, you can use regex to match the delimiter.

  5. Splitting on last delimiter in Python string? - Stack Overflow

    428 What's the recommended Python idiom for splitting a string on the last occurrence of the delimiter in the string? example:

  6. Python: How can I include the delimiter(s) in a string split?

    I would like to split a string, with multiple delimiters, but keep the delimiters in the resulting list. I think this is a useful thing to do an an initial step of parsing any kind of formula, and I suspect there is a nice …

  7. python - Splitting on first occurrence - Stack Overflow

    The .split method of regular expressions has the same argument as the built-in string .split method, to limit the number of splits. Again, no splitting is done when the delimiter does not appear:

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

    my_string="hello python world , i'm a beginner" print(my_string.split("world",1)[1]) split takes the word (or character) to split on and optionally a limit to the number of splits. In this example, split on "world" …

  9. python - How do I split a string into a list of characters? - Stack ...

    This is a mere for, there's not much to explain. I think you should read the python tutorial on data structures, especially list comprehension.

  10. Split string at delimiter '\' in python - Stack Overflow

    May 27, 2016 · If you’re not using a raw string to express the pattern, remember that Python also uses the backslash as an escape sequence in string literals; if the escape sequence isn’t recognized by …