I\'m running into an issue that I hope is simple, however I\'ve run into a wall trying to figure it out. I\'m attempting to strip the DateTime timestamp from the beginning
b
is '[Wed Dec 01 10:24:24 2010]'
so then you strip any of the characters that are in b from c
so everything bar ct
get removed:
'[Wed Dec 01 10:24:24 2010] ceeeeest'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# all in [Wed Dec 01 10:24:24 2010]
So only st
remain as they are the only two characters no in b
, strip will keep stripping from both ends until it hits char not in the set:
In [3]: s = "fooboaroof"
In [4]: s.strip("foo")
Out[4]: 'boar'
If the date is always at the start which it must be if you are using match, when you get a match the simplest would be to split:
line2 = '[Wed Dec 01 10:24:24 2010] ceeeeest'
print(line2.split("] ", 1)[1])
Or:
print(line2[len(a.group()):].lstrip())