About 171,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 …

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

    This doesn't work well for your example string, but works nicely for a comma-space separated list. For your example string, you can combine the re.split power to split on regex patterns to get a …

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

    How do I split a string into a list of characters? str.split does not work.

  4. 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.

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

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

    Jan 15, 2018 · "How to split a column" has different answers depending on whether the column is string, list, or something else, also what format (e.g. 'formatted string' like an address, for …

  7. How to split a dos path into its components in Python

    import os path = os.path.normpath(path) path.split(os.sep) First normalize the path string into a proper string for the OS. Then os.sep must be safe to use as a delimiter in string function split.

  8. python - How to split a string based on either a colon or a hyphen ...

    Apr 17, 2015 · Are you trying to make a list of all elements seperated by either a '-' or ':'. Or just remove those characters from the string and return the new string sans thats character?

  9. regex - Split string on whitespace in Python - Stack Overflow

    31 Using split() will be the most Pythonic way of splitting on a string. It's also useful to remember that if you use split() on a string that does not have a whitespace then that string will be …

  10. 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), …