使用python 3获取HTML内容

时间:2018-12-03 06:44:16

标签: html python-3.x web-scraping beautifulsoup

试图获取10天天气预报,无法从网站获取确切的html。我现在被困住了

import mechanicalsoup
import requests
from bs4 import BeautifulSoup
from PIL import Image
import imghdr
import urllib.request
import io
browser = mechanicalsoup.StatefulBrowser()
browser.open("http://www.intellicast.com/")
browser.select_form()
browser["query"] = input("enter city,country")
response = browser.submit_selected()
html = response.text
html = html.replace('<!--[if lte IE 9]>', '').replace('<![endif]-->', '')
soup = BeautifulSoup(html, features="lxml")
trial = soup.find("div", {"class": "main container clearfix"})
print(trial)`  

请帮助 预先感谢。

0 个答案:

没有答案