python - Count The occurence of a word -


i new python , making use of requests in python . asked loggin on xyz.com able . , extract table contents link discussion . in each of these link need find occurence of "the" word . how should proceed ?my code given below

tags=content2.findall("td",{'class':'topic starter'}) in tags:     thread_link=i.find('a').get('href')     print(thread_link)     result3=session.post(thread_link)     content3=bs4.beautifulsoup(result3.text,'html.parser')     tag3=content3.find("the",count+1)      print(count)  

i have find occurence of in each link , print it!!

you not doing correctly. tag3 finding the tag. code little messy. can use regex cause. here search the in result text.

import re in tags:     thread_link=i.find('a').get('href')     print(thread_link)     result3=session.post(thread_link)     count=len(re.findall('\sthe\s',result3.text))     print(count)  

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -