Python PEP484 source:
def splitn(string: str, delim: str, max_splits: int) -> List[str]: splits: List[str] = [] string_begin: int = 0 for i in range(max_splits): split_begin: int = string.find(delim, string_begin) if split_begin == -1: break splits.append(string[string_begin : split_begin]) string_begin = split_begin + len(delim) splits.append(string[string_begin:]) return splits
Outputs
pep484 py js cpp rust