[root@localhost /]#
[root@localhost /]# cat split.py
#!/bin/python
import re
s='aa,bb:cc;dd/teegg'
def mysplit(s,symbol):
t=[s]
for num in symbol:
res=[]
map(lambda x:res.extend(x.split(num)),t)
t=res
return [x for x in res if x]
print mysplit(s,r',:;/t<>')
print re.split(r'[,:;/t<>]+',s)
[root@localhost /]#
[root@localhost /]#
阅读(4575) | 评论(0) | 转发(0) |