I have some strings like:
\i{}Agrostis\i0{} <L.>
I would like to get rid of the '\i{}', '\io{}' characters, so that I could get just:
Agrostis <L.>
I've tried the following code (adapted from here):
m = re.search('\i{}(.+?)\i0', item_name)
if m:
name = m.group(1).strip('\\')
else:
name = item_name
It works in part, because when I run it I get just:
Agrostis
without the
<L.>
part (which I want to keep).
Any hints?
Thanks in advance for any assistance you can provide!