Let's say I have text file that contains (acquired from a page source):
Manager:
<a href="/name/nm0001392/?ref_=adv_li_dr_0"
>Mark Smith</a>
<span class="ghost">|</span>
Managers:
<a href="/name/nm0905154/?ref_=adv_li_dr_0"
>Herb Dean</a>,
<a href="/name/nm0905152/?ref_=adv_li_dr_1"
>Jon Anik</a>
<span class="ghost">|</span>
Manager:
<a href="/name/nm0001392/?ref_=adv_li_dr_0"
>Dominick Cruz</a>
<span class="ghost">|</span>
I open the file with:
with open('managers.txt', 'r') as file:
data = file.read().replace('\n', '')
Using regex (or another way if easier, but regex is mainly what I've been working with), how can I get the end result to be:
result = ["Mark Smith", "Herb Dean,Jon Anik", "Dominick Cruz"]
so that when it's "Managers", they are placed in the same string in the list, as shown in the example above.
I've tried the following without succeeding with what I want:
manager_list= re.findall(r'Manager:<a href=(.*?)</a>', data)
Thank you for any kind of help!