str.split()
str.split() is a Python method in the String Methods category. Splits the string into a list by separator. The syntax is str.split(sep=None, maxsplit=-1). Parameters: sep — separator string. Returns: List of substrings. A typical example: "a,b,c".split(",") # ["a", "b", "c"]
"a b c".split() # ["a", "b", "c"]
"a,b,c".split(",", 1) # ["a", "b,c"]. A close sibling is str.upper(), which returns a copy of the string with all characters converted to uppercase. A close sibling is str.lower(), which returns a copy of the string with all characters converted to lowercase. A close sibling is str.capitalize(), which returns a copy with the first character capitalized and the rest lowercased. A close sibling is str.title(), which returns a titlecased version where each word starts with uppercase. More about this category: String methods for text manipulation — split, join, replace, format, and more. For a broader walkthrough, read the String Methods guide.