map实现
def mySplit(s, ds): res = [s] for d in ds: t = [] list(map(lambda x: t.extend(x.split(d)), res)) res = t return [x for x in res if x]s = 'ab;cd|efg|hi,jkl|mn\topq;rst,uvw\txyz'ds = ';,|\t'print(mySplit(s, ds))
re.split实现
import res = 'ab;cd|efg|hi,jkl|mn\topq;rst,uvw\txyz'ds = ';,|\t'print(re.split(r'[,;\t|]+', s))