PyDocs

Nav

Python Runtime Services

str.split

builtins

method of str
  • str.split(sep=None, maxsplit=-1)
Return a list of the substrings in the string, using sep as the separator string.

  sep
    The separator used to split the string.

    When set to None (the default value), will split on any
    whitespace character (including \n \r \t \f and spaces) and
    will discard empty strings from the result.
  maxsplit
    Maximum number of splits.
    -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been
intentionally delimited.  With natural text that includes
punctuation, consider using the regular expression module.
1 Example
>>> "1,2,3".split(",")
# => ['1', '2', '3']
See Also
No see-alsos for builtins/str.split
0 Notes
No notes for str.split