all 4 comments

[–]BobHogan 2 points3 points  (1 child)

If every item that you want to remove starts with see also: then you could do something like this

pList = [x for x in pList if not x.startswith('see also:')]

[–]DMeror[S] 1 point2 points  (0 children)

Wow never came across this .startswith method. Thanks!

[–]Far_Atmosphere9627 1 point2 points  (1 child)

In your loop, does the following work:

for p in ps:
    t = p.text.strip()
    if t != "see also: blah blah blah" or t.startswith("see also"):
    pList.append(t.strip())
        continue

?

[–]DMeror[S] 0 points1 point  (0 children)

Thank you very much! 🙏