python - Beautifulsoup error with class content Hyphens "-"? -


i used python 2.7 + beautifulsoup 4.4.1

e = beautifulsoup(data) s1 = e.find("div", class_="one").get_text() # successful s2 = e.find("div", class_="two-three").get_text() # error 

after, looking @ screenshot in comments:

first of need read response, cannot directly cast str:

e = e.read() 

second, seems of content being populated using javascript hence html doesn't contain tags.

i.e. there no elements present class rating-count:

>>> s.find('span', class_='rating-count') [] 

it doesn't mean hyphenated search class name not working because if try display-price work:

>>> s.find('span', class_='display-price')  <span class="display-price">free</span> 

which means ones trying aren't available in html said earlier in comments.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -