从 html 标签中提取文本

Extract text from html tag

<li itemprop="foundingLocation" itemscope="" itemtype="https://schema.org/Place"><i class="icon-location"></i><span itemprop="address" itemscope="" itemtype="https://schema.org/PostalAddress">India, Delhi, Delhi</span></li>
<li><i class="icon-phone text-success"></i><a class="link visit-website-tracking" data-container="body" data-content="+91 9643861253" data-info="phone:triazine-software-pvt-ltd" data-placement="top" data-toggle="popover" rel="nofollow" role="button">Show phone number</a></li>
<li><i class="icon-office"></i>Founded: <span itemprop="foundingDate">2015</span></li>
<li itemprop="numberOfEmployees" itemscope="" itemtype="https://schema.org/QuantitativeValue"><i class="icon-users"></i><span itemprop="value">50-100</span> employees</li>
<li><i class="icon-budget"></i>Avg. budget: k-k (USD)</li>
<li><i class="icon-hourly"></i>Hourly fee: /h (USD)</li>

我需要提取

India, Delhi, Delhi
+91 9643861253
2015
50-100
Avg. budget: k-k (USD)
Hourly fee: /h (USD)

我怎样才能进一步完成这个任务?

我的代码:

from urllib.request import urlopen
from bs4 import BeautifulSoup

url = "https://www.appfutura.com/developers/triazine-software-pvt-ltd"
html = urlopen(url).read()
soup = BeautifulSoup(html,"lxml")
class_list = ["developer-description"] # can add any other classes to this list.
Title = soup.find('h1',{"class":"big-title no-mar-top no-mar-bot strong"})
Info = soup.find('ul',{"class":"list-inline no-mar"})
for i in range(len(Info)):
    print(Info.contents[i])
    soup = BeautifulSoup(Info.contents[i],"lxml")
    Title = soup.find('i',{"class":"icon-budget"})
    print(Title.contents)

试试这个:

from urllib.request import urlopen

from bs4 import BeautifulSoup

html = urlopen("https://www.appfutura.com/developers/triazine-software-pvt-ltd").read()
soup = BeautifulSoup(html, "lxml").select_one('.profile .list-inline').find_all("li")

info = [i.getText() for i in soup if not i.getText().startswith("Show")]
phone = "".join(i.find("a")["data-content"] for i in soup if i.find("a"))

info.insert(1, phone)
print("\n".join(info))

输出:

India, Delhi, Delhi
+91 9643861253
Founded: 2015
50-100 employees
Avg. budget: k-k (USD)
Hourly fee: /h (USD)