The problem of determining the value of Beautiful Soup

< span data-original-name= < Duke University Blue Devil Men"s Basketball team > Duke University Blue Devil Men"s Basketball team

< span data-original-name= "unknown" > unknown

how to get the Duke University Blue Devil Men"s Basketball team out with Beautiful Soup Library

< hr >

now I want to search for English keywords through Google and recommend translation on the right side of the results page.
the following figure:

:





to learn this kind of framework, take a closer look at the official api, and don't rely too much on third-party tools. This can increase efficiency. Your problem can be solved like this, for example:

head_tag = soup.head
head_tag
-sharp <head><title>The Dormouse's story</title></head>

head_tag.contents
[<title>The Dormouse's story</title>]

title_tag = head_tag.contents[0]
title_tag
-sharp <title>The Dormouse's story</title>
title_tag.contents
-sharp [u'The Dormouse's story']

documents I learned to use before: Beautiful Soup 4.2.0 documents


 bs4

-sharp 
r = requests.get(url + list1[i],headers =header)
-sharp 
reObj = re.findall('<span data-original-name="(.*?)">',r.content)
Menu