Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8177523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:31:50+00:00 2026-06-06T23:31:50+00:00

Using Beautiful Soup module, how can I get data of a div tag whose

  • 0

Using Beautiful Soup module, how can I get data of a div tag whose class name is feeditemcontent cxfeeditemcontent? Is it:

soup.class['feeditemcontent cxfeeditemcontent']

or:

soup.find_all('class')

This is the HTML source:

<div class="feeditemcontent cxfeeditemcontent">
    <div class="feeditembodyandfooter">
         <div class="feeditembody">
         <span>The actual data is some where here</span>
         </div>
     </div>
 </div> 

and this is the Python code:

 from BeautifulSoup import BeautifulSoup
 html_doc = open('home.jsp.html', 'r')

 soup = BeautifulSoup(html_doc)
 class="feeditemcontent cxfeeditemcontent"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:31:51+00:00Added an answer on June 6, 2026 at 11:31 pm

    Try this, maybe it’s too much for this simple thing but it works:

    def match_class(target):
        target = target.split()
        def do_match(tag):
            try:
                classes = dict(tag.attrs)["class"]
            except KeyError:
                classes = ""
            classes = classes.split()
            return all(c in classes for c in target)
        return do_match
    
    html = """<div class="feeditemcontent cxfeeditemcontent">
    <div class="feeditembodyandfooter">
    <div class="feeditembody">
    <span>The actual data is some where here</span>
    </div>
    </div>
    </div>"""
    
    from BeautifulSoup import BeautifulSoup
    
    soup = BeautifulSoup(html)
    
    matches = soup.findAll(match_class("feeditemcontent cxfeeditemcontent"))
    for m in matches:
        print m
        print "-"*10
    
    matches = soup.findAll(match_class("feeditembody"))
    for m in matches:
        print m
        print "-"*10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am data mining a website using Beautiful Soup . The first page is
I'm using Mechanize and Beautiful soup to scrape some data off Delicious from mechanize
Is there an equivalent of Beautiful Soup's tag.renderContents() method in lxml? I've tried using
I am using python's beautiful stone soup to extract data from this web page
I am using Beautiful Soup to identify a specific tag and its contents. The
I am using Beautiful Soup 3.2 on python 2.7.1 here. I have recently been
I'm using beautiful soup (in Python). I have such hidden input object: <input type=hidden
I am using Beautiful Soup for parsing web pages. Are there any functions in
I'm using Beautiful Soup for extracting some texts. The program works on the command
I'm parsing some HTML using Beautiful Soup, and occasionally the HTML it returns includes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.