日誌11月4日
BeautifulSoup常用方式程式碼:
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
from bs4 import BeautifulSoup
def getBSObj(url):
"""根據url獲取頁面的物件"""
try:
html = urlopen(url)
except (HTTPError, URLError) as e:
return None
try:
bsObj = BeautifulSoup(html.read(), features = "lxml")
except (AttributeError) as e:
return None
return bsObj
bsObj = getBSObj("http://pythonscraping.com/pages/warandpeace.html")
if bsObj == None:
print("BSObj could not be found")
else:
#使用find_all()函式抽取只包含在<span class="green"></span>標籤裡的文字
nameList = bsObj.find_all("span", {"class" : "green"})
for name in nameList:
#get_text()清楚所有標籤,返回一個只包含文字的字串
print(name.get_text())
相關文章
- 日誌11月18日
- 日誌11月24日
- 11月26實驗室日誌
- 日誌12月16日
- 3月11日
- 4月11日
- Qtum量子鏈週報(11月19日-11月25日)QT
- 11g rac 日誌
- Oracle 11g RAC檢視ASM日誌、grid日誌和DB日誌OracleASM
- 11月11日—11月17日共有46款遊戲開測|GameRes遊戲GAM
- RAC 11g的日誌
- 第11章 日誌記錄
- 2013年12月日誌
- 2013年7月日誌
- 2013年8月日誌
- 2013年9月日誌
- 2013年10月日誌
- 刪除oracle 11g的警告日誌和監聽日誌Oracle
- ORACLE 11G RAC 增加日誌組及增大日誌檔案Oracle
- 11月18日—11月24日共有58款遊戲開測|GameRes遊戲GAM
- 11月23日—11月29日共有42款遊戲開測|GameRes遊戲GAM
- 11月2日—11月8日共有41款遊戲開測|GameRes遊戲GAM
- 11月21日—11月27日共有28款遊戲開測|GameRes遊戲GAM
- 11月15日—11月21日共有28款遊戲開測|GameRes遊戲GAM
- 11月22日—11月28日共有16款遊戲開測|GameRes遊戲GAM
- 11月1日—11月7日共有13款遊戲開測|GameRes遊戲GAM
- 11.日誌和事務@Transactional
- oracle 11g的警告日誌Oracle
- 2014年02月日誌
- 2014年01月日誌
- 2014年03月日誌
- 4月11日每日總結
- 從alert日誌看Oracle 11g Datagurad日誌傳輸(上)Oracle
- 從alert日誌看Oracle 11g Datagurad日誌傳輸(下)Oracle
- 【11g】11g 中警告日誌的位置
- oracle11G歸檔日誌管理Oracle
- 2020-11-29日誌
- 11g的alert日誌路徑