So I have a string
s = '>n269412 | AK142815 | msdfhakjfdkjfs'
and I want to include everything up to but not including the first instance of '|'
so what I did was
import re
p = re.search('|',s)
print s[:p]
but i got this error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
I understand why it isn't working . . because that value is not an integer but is there any way I can use that value where the search found that element ?