python - Same code different result on different computers -
i can run these code correctly on 2 computers, ios, windows, can find 98 names on company's computer, linux. , use python 2.7
import requests, bs4   index_url = 'http://www.nlm.nih.gov/medlineplus/druginfo/herb_all.html'  def get_urls():     response = requests.get(index_url)     soup = bs4.beautifulsoup(response.text)     #print(response.)     return [a.attrs.get('href') in soup.select('div.section-body a[href^=]')] print(len(get_urls()))      
perhaps make sure using same parser , maybe specify html parser using in code way when run on different machine know 1 use.
beautifulsoup(markup, "html.parser")   there more info in documentation.
Comments
Post a Comment