Skip to content

Instantly share code, notes, and snippets.

@russelllim22
Created August 25, 2021 11:29
Show Gist options
  • Save russelllim22/2f1802a4680f1ef6541eab4616354703 to your computer and use it in GitHub Desktop.
Save russelllim22/2f1802a4680f1ef6541eab4616354703 to your computer and use it in GitHub Desktop.
for a in sect.find_all('a'):
# i'm looking for an <a> tag in the <section> that starts with the string "&nbsp;in"
if (len(a.text) > 4 and a.text[0].isspace() and a.text[1:3] == "in"):
# The publication name is inside the <a> tag following the substring "&nbsp;in"
pub_name = a.text[4:]
if pub_name in pubs:
pub_count[pubs.index(pub_name)] += 1
else:
pubs.append(pub_name)
pub_count.append(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment