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

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

  3. How does Python split() function works - Stack Overflow

    Dec 4, 2016 · For example \n is a newline character inside a python string which will lose its meaning in a raw string and will simply mean backslash followed by n. string.split() string.split() will break and …

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

    Great. If you want alternating tokens and separators, as you usually do, it would of course be better to use \W+. The algorithm behind split also seems to indicate whether your list begins/ends with a token …

  5. python - How do I split a multi-line string into multiple lines ...

    Why you should NOT use split("\n") Using split creates very confusing bugs when sharing files across operating systems. \n in Python represents a Unix line-break (ASCII decimal code 10), independently …

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

  7. python - Splitting on first occurrence - Stack Overflow

    To split on the last occurrence instead, see Partition string in Python and get value of last segment after colon.

  8. python - How to split elements of a list? - Stack Overflow

    So i.split ('\t', 1) calls the split () method of strings. Per the documentation, the first parameter of this method is the string to split by and the second is the maximum number of splits to perform. The …

  9. How to split an integer into a list of digits? - Stack Overflow

    Dec 15, 2009 · Suppose I have an input integer 12345. How can I split it into a list like [1, 2, 3, 4, 5]?

  10. 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?.