讀取特定類的網頁我有使用HTMLParser
一個腳本,從網頁讀取data
:使用python
import urllib
from HTMLParser import HTMLParser
import re
class get_HTML_Info(HTMLParser):
def handle_data(self, data):
print data
adib = urllib.urlopen('http://www.bulldoghax.com/secret/spinner')
htmlsource = adib.read()
adib.close()
parser = get_HTML_Info()
parser.feed(str(htmlsource))
我結束了兩個組數據是這樣的:
bulldoghax
8530330882
在終端中,我只想提取只有該數字並將其設置爲python中的字符串。
謝謝!,這是完美的!,我只是不得不改變'湯= BeautifulSoup(htmlsource)''湯= BeautifulSoup(htmlsource, 「lxml」)'因爲它在第一次嘗試時給了我一個錯誤 – shoomy
@himanshu_dua你能幫我編寫一個代碼,它發送一個cookie數值給這個網站'http://www.bulldoghax.com/secret/codes' – shoomy