Lets Say we have Zaptoit:685158:zaptoit@hotmail.com
How do you split so it only be left 685158:zaptoit@hotmail.com
Another method, without using split:
s = 'Zaptoit:685158:zaptoit@hotmail.com'
s[s.find(':')+1:]
Ex:
>>> s = 'Zaptoit:685158:zaptoit@hotmail.com'
>>> s[s.find(':')+1:]
'685158:zaptoit@hotmail.com'
Following splits the string, ignores first element and rejoins the rest:
":".join(x.split(":")[1:])
Output:
'685158:zaptoit@hotmail.com'
Use the method str.split() with the value of maxsplit argument as 1.
mailID = 'Zaptoit:685158:zaptoit@hotmail.com'
mailID.split(':', 1)[1]
Hope it helped.
>>> s = 'Zaptoit:685158:zaptoit@hotmail.com'
>>> s.split( ':', 1 )[1]
'685158:zaptoit@hotmail.com'
Another solution:
s = 'Zaptoit:685158:zaptoit@hotmail.com'
s.split(':', 1)[1]
s = re.sub('^.*?:', '', s)