Skip to content

Commit f6c545f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 376b637 commit f6c545f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

strings/split.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ def split(string: str, separator: str = " ") -> list:
2121

2222
for index, char in enumerate(string):
2323
if char == separator:
24-
split_words.append(string[last_index:index]) # Add substring between separators
24+
split_words.append(
25+
string[last_index:index]
26+
) # Add substring between separators
2527
last_index = index + 1
26-
elif index + 1 == len(string): # If at the last character, handle trailing separator
28+
elif index + 1 == len(
29+
string
30+
): # If at the last character, handle trailing separator
2731
split_words.append(string[last_index:]) # Add the last part of the string
2832

2933
# If the string ends with a separator, ensure an empty string is added
3034
if string and string[-1] == separator:
31-
split_words.append('')
35+
split_words.append("")
3236

3337
return split_words
3438

39+
3540
if __name__ == "__main__":
3641
from doctest import testmod
42+
3743
testmod()

0 commit comments

Comments
 (0)