scraping dynamic updates of temperature sensor data from a website

后端 未结 3 448
天涯浪人
天涯浪人 2021-01-17 06:24

I wrote following python code:

from bs4 import BeautifulSoup
import urllib2

url= \'http://www.example.com\'
page = urllib2.urlopen(url)
soup = BeautifulSoup         


        
3条回答
  •  悲哀的现实
    2021-01-17 07:03

    This should do it:

    freq.text.strip()
    

    As in

    >>> html = '
    tempsensor
    ' >>> soup = BeautifulSoup(html) >>> soup.text.strip() u'tempsensor'

提交回复
热议问题