bs4

    0熱度

    3回答

    我正在終端和ipython筆記本中的命令行運行正常的腳本中運行以下python導入。 #!/usr/bin/python import os import re import urllib import urllib2 as ul import sys from bs4 import BeautifulSoup as bs 當它通過從蘋果的launchd一個的.plist文件我碰到

    2熱度

    1回答

    我有一些問題網頁抓取,這裏是我的代碼: from bs4 import BeautifulSoup import requests import re import csv import argparse def save_csv_file(filename, array): with open(filename, 'wb') as f: writer = cs

    1熱度

    3回答

    這是從網站的源代碼佈局: <div class="address"> <a href="https://website.ca/classifieds/59-barclay-street/"> 59 Some Street<br />City, Zone 1 </a> </div> 我想獲得的街道號碼,路線,以及城市地理編碼谷歌。如果我這樣做 >>>articl

    3熱度

    1回答

    我有一個自動關閉標記的html文件,但BeautifulSoup不喜歡它們。 from bs4 import BeautifulSoup html = '<head><meta content="text/html" http-equiv="Content-Type"><meta charset="utf-8"></head>' doc = BeautifulSoup(html, 'html.

    1熱度

    1回答

    我用requests在Python中發出請求。 然後我用bs4來選擇想要的div。我現在要算在該div文本的長度,但我把它弄出來的字符串包括所有的標籤太多,例如: <div><a class="some_class">Text here!</a></div> 我想只能算Text here!,沒有所有的div和a標籤。 任何人都有任何想法我可以做到這一點?

    0熱度

    1回答

    我使用BeautifulSoup從Google搜索結果中提取所有鏈接頁。 這裏的代碼片段: import requests,bs4 res = requests.get('https://www.google.com/#q=vigilante+mic') soup = bs4.BeautifulSoup(res.text) linkElem = soup.sel

    1熱度

    1回答

    如何在使用python 3和beautifulsoup時使用相同的排列方式來獲取所有文本4.我嘗試了一個for循環,但沒有奏效。 from bs4 import BeautifulSoup data = """ <body> <div id="Select"> <h1 id="wall"> First </h1> </div>

    1熱度

    1回答

    我想添加內部鏈接到某些關鍵字,如鏈接所有字index到我的網站的主頁。 我打算使用BeautifulSoup4,但我不知道如何將標籤添加到元素中的某個單詞。 這就是我想要的。 <div>You can find the content from the index page</div> 要 <div>You can find the content from the <a href='inde

    1熱度

    1回答

    爲什麼不是以下工作刮谷歌的搜索結果? 它試圖打開響應投擲HTTPError失敗。我看了其他問題,並據我所知,我已經完成了編碼等正確。 我知道我沒有包括捕捉錯誤等,這只是一個縮小版本。 def scrape_google(query): url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&" head

    1熱度

    1回答

    我有一個結構類似這樣的XHTML文件:我使用BeautifulSoup <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> ... </head> <body> ... </body> <html> ,我想從文件中刪除XML聲明,所以我看起來像這樣: <!DOCTYPE