def split(s, cut):
s = s + cut
l = len(s)
p = 0
res = []
for i in range(l):
if s[i] == cut:
res.append(s[p:i])
p = i + 1
return res
if __name__ == '__main__':
s = 'ddf hhj, ll?yyy?i bb,gg;tt dfg'
print(split(s, ','))
print(s.split(','))
python手动实现split函数
最新推荐文章于 2023-04-11 20:00:37 发布