a guest Jul 15th, 2019 11 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- openn = '<'
- closed = '>'
- message ='one<test>two<test>three<test>four'
- import re as re
- close = [n.start() for n in re.finditer(closed, message)]
- open = [m.start() for m in re.finditer(openn, message)]
- stri = 
- for i in range(len(open)):
- if (i==0):
- stri = message[0:open[i]]
- elif(i == (len(open))-1):
- stri+= message[close[i]:]
- stri+= message[close[i]:open[i+1]]
RAW Paste Data