Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
word counter
#2
(Jun-19-2019, 10:42 PM)kid_with_polio Wrote: I just want the thread titles
Try this:
import requests
from bs4 import BeautifulSoup
import operator
 
def start(url):
    word_list = []
    source_code = requests.get(url).text
    soup = BeautifulSoup(source_code, "html.parser")
    for span in soup.find_all('tr', {'class': 'inline_row'}):
        print(span.find_all('a')[1].text)
        
        '''
        content = str(span)
        words = content.lower().split()
        for each_word in words:
            print(each_word)
            word_list.append(each_word)
        '''
 
 
start('https://python-forum.io/Forum-Data-Science')
Output:
Aligning data [pandas] How to re-arrange DataFrame columns Aligning excel data Two dataframes merged Distance between 2 user defined geo-grids in km [pandas] Convert categorical data to numbers Market Basket Analysis: Finding Association Rules [pandas] Find the first element that is -1 Optimizing a model output (Y) with some (X) parameters defined Suggestion needed for Natural Language Processing Project Simple String to Time within a pandas dataframe span color on graph sunset/dawn list comprehension invalid syntax Protein interaction chains Statistical analysis of two dataframes Use Python Packages to Increment a Column(not a row) SciKit vs Dynamo vs Grasshopper/Dodo for A.I. Planner Project xticks google webscraper Custom timeinterval converted to hourly values using Pandas?
Recommended Tutorials:
Reply


Messages In This Thread
word counter - by kid_with_polio - Jun-19-2019, 10:42 PM
RE: word counter - by metulburr - Jun-19-2019, 10:49 PM
RE: word counter - by kid_with_polio - Jun-19-2019, 10:56 PM
RE: word counter - by Yoriz - Jun-19-2019, 11:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: missing 1 required positional argument (word counter Django app) Drone4four 2 14,699 Jul-11-2019, 09:34 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020