Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # split_replace.py
- sss = "python 123abc xyz ###abc### 123 ###abc###"
- item = 'abc'
- def split_replace(sss):
- s=''
- while item in sss: tmp,sss = sss.lstrip().split(item,1); s += item+' '+tmp+' '
- return s + item+' '+sss
- print split_replace(sss)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement