I would like to strip ‘s (apostrophe s) from a string.
For example:
a="it's tail was big".split()
for i in range(len(a)):
a[i]= a[i].strip(r"\'s")
a becomes
['it', 'tail', 'wa', 'big']
whereas I am expecting
['it', 'tail', 'was', 'big']
How do I make it strip ‘s and not s ? I tried strip(r”\’s”) too & it doesn’t work either.
And
Is there a better way to do this than what I have done?
Thanks!
You can replace the
'swith empty string and then split.