About 158,000 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. python - How do I split a string into a list of words? - Stack Overflow

    To split on other delimiters, see Split a string by a delimiter in python. To split into individual characters, see How do I split a string into a list of characters?.

  4. python - How to split a dataframe string column into two columns ...

    Jan 15, 2018 · 1: If you're unsure what the first two parameters of .str.split() do, I recommend the docs for the plain Python version of the method. But how do you go from: a column containing two …

  5. split() vs rsplit() in Python - Stack Overflow

    Dec 13, 2022 · The difference between split and rsplit is pronounced only if the maxsplit parameter is given. In this case the function split returns at most maxsplit splits from the left while rsplit returns at …

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

  7. How do i split a string in python with multiple separators?

    Jun 15, 2012 · 5 You can use str.split([sep[, maxsplit]]) Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done (thus, the list will have at …

  8. Pandas - Get last element after str.split () - Stack Overflow

    Dec 11, 2018 · I use pandas and I have data and the data look like this FirstName LastName StudentID FirstName2 LastName2 StudentID2 Then I split it based on 'space' using str.split() So the data will …

  9. How to split by comma and strip white spaces in Python?

    map(str.strip, string.split(',')) but saw it had already been mentioned by Jason Orendorff in a comment. Reading Glenn Maynard's comment on the same answer suggesting list comprehensions over map I …

  10. python - Splitting on first occurrence - Stack Overflow

    What would be the best way to split a string on the first occurrence of a delimiter? For example: "123mango abcd mango kiwi peach" splitting on the first mango to get: " abcd …