Possible Duplicate:
Python split string on regex
How do I split some text using Python's re module into two parts: the text before a special word cut and the rest of the text following it.
Possible Duplicate:
Python split string on regex
How do I split some text using Python's re module into two parts: the text before a special word cut and the rest of the text following it.
Check this, might help you
>>> re.compile('[0-9]+').split("hel2l3o")
['hel', 'l', 'o']
>>>
>>> re.compile('cut').split("hellocutworldcutpython")
['hello', 'world', 'python']
split about first cut
>>> l=re.compile('cut').split("hellocutworldcutpython")
>>> print l[0], string.join([l[i] for i in range(1, len(l))], "")
hello worldpython