Extract text between link tags in python using BeautifulSoup
问题 I have an html code like this: <h2 class="title"><a href="http://www.gurletins.com">My HomePage</a></h2> <h2 class="title"><a href="http://www.gurletins.com/sections">Sections</a></h2> I need to extract the texts (link descriptions) between 'a' tags. I need an array to store these like: a[0] = "My HomePage" a[1] = "Sections" I need to do this in python using BeautifulSoup. Please help me, thank you! 回答1: You can do something like this: import BeautifulSoup html = """ <html><head></head> <body