# pattern支持字符或者字符串
def my_split(string, pattern):
ret = []
len_pattern = len(pattern)
while True:
index = string.find(pattern)
if index == -1:
ret.append(string)
return ret
else:
ret.append(string[:index])
string = string[index+len_pattern:]
if __name__=="__main__":
print(my_split("abcded", "cd"))
print(my_split("abcded", "d"))