小编Vla*_*gza的帖子

使用 bs4 进行 HTML 解析

我正在解析一个 HTMl 页面,并且很难弄清楚如何在没有类或 id 的情况下提取某个“p”标签。我试图用纬度和经度到达“p”的标签。这是我当前的代码:

 import bs4
 from urllib import urlopen as uReq #this opens the URL
 from bs4 import BeautifulSoup as soup #parses/cuts  the html

 my_url = 'http://www.fortwiki.com/Battery_Adair'
 print(my_url)
 uClient = uReq(my_url) #opens the HTML and stores it in uClients

 page_html = uClient.read() # reads the URL
 uClient.close() # closes the URL

 page_soup = soup(page_html, "html.parser") #parses/cuts the HTML
 containers = page_soup.find_all("table")
 for container in containers:
    title = container.tr.p.b.text.strip()
    history = container.tr.p.text.strip()
      lat_long = container.tr.table
       print(title)
       print(history)
       print(lat_long)
Run Code Online (Sandbox Code Playgroud)

网站链接: …

python beautifulsoup

4
推荐指数
1
解决办法
8435
查看次数

Angular 6 将参数传入 URL

所以我有一个 angular 应用程序,它当前有一个诸如“urlname/stockdata”的路由。我希望能够将股票代码传递到该网址中,例如“urlname/stockdata/AAPL”。我的应用程序正在使用该符号调用第三方 API。你们对我如何做到这一点有什么建议吗?任何帮助表示赞赏。谢谢

javascript routing angular

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×1

beautifulsoup ×1

javascript ×1

python ×1

routing ×1