I would like to remove all the unnecessary characters (in bold) before the 1st entry in a python list. I am trying to use regex to make it happen, please review my code?
Edit : I would like to remove all characters before and including the word safe.
['xian/gps_201610010000644016240301624032416162641013323634045015307 0ustar bigdata_safebigdata_safea01b8439e1e42ffcd286241b04d9b1b5,f11440a64a0f084fe346a398c62aa9ad,1475277482,108.92466,34.27657', 'a01b8439e1e42ffcd286241b04d9b1b5,f11440a64a0f084fe346a398c62aa9ad,1475277488,108.92527,34.27658', 'a01b8439e1e42ffcd286241b04d9b1b5,f11440a64a0f084fe346a398c62aa9ad,1475277506,108.9276,34.27659', 'a01b8439e1e42ffcd286241b04d9b1b5,f11440a64a0f084fe346a398c62aa9ad,1475277476,108.92399,34.27655', 'a01b8439e1e42ffcd286241b04d9b1b5,f11440a64a0f084fe346a398c62aa9ad,1475277515,108.9291,34.2766']
def removePunctuation(text):
text = re.sub(r"\x00+",'',text)
test = re.sub(r'.*a01', '',text)
return text