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

  • Home
  • SEARCH
  • 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 795917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:33:24+00:00 2026-05-14T22:33:24+00:00

Hey can someone help with the following? I’m trying to scrape a site that

  • 0

Hey can someone help with the following?

I’m trying to scrape a site that has the following information.. I need to pull just the number after the </strong> tag..

[<li><strong>ISBN-13:</strong> 9780375853401</li>, <li><strong>Pub. Date: </strong> 05/11/2010</li>]
[<li><strong>UPC:</strong> 490355000372</li>, <li><strong>Catalog No:</strong> 15024/25</li>, <li><strong>Label:</strong> CAMERATA</li>]

here’s a piece of the code I’ve been using to grab the above data using mechanize and BeautifulSoup. I’m stuck here as it won’t let me use the find() function for a list

br_results = mechanize.urlopen(br_results)
html = br_results.read()
soup = BeautifulSoup(html)
local_links = soup.findAll("a", {"class" : "down-arrow csa"})
upc_code = soup.findAll("ul", {"class" : "bc-meta3"})
for upc in upc_code:
    upc_text = upc.contents.contents
    print upc_text
  • 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-05-14T22:33:25+00:00Added an answer on May 14, 2026 at 10:33 pm

    I imagine upc_code is the list you’re showing us, and the local_links one has nothing to do with your question right? Given that you don’t mention it further in your code…?

    So I’m not certain what upc_text would be in your loop’s body given that upc is a ul Tag — upc.contents is going to be a list of li tags (presumably), and I don’t see how upc.contents.contents can work — what are you seeing as a result of that code? I would have expected an exception!

    Anyway, the way I’d write the loop would be something like:

    for upc in upc_code:
        listitems = upc.findAll('li')
        for anitem in listitems:
            print anitem.contents[1]
    

    since you appear to want the second child of each list item (the first one is the strong tag, the second one the navigable string you want.

    If it’s not the second child of each list item that you want, please clarify; for example, you could identify the strong and get its next sibling, if that suits you better — just make the body of the nested loop into

    print anitem.find('strong').nextSibling
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys, this might be really stupid, but hopefully someone can help. I'm trying
Hey hope someone can help as I am at my wits end with this!?
Hey ppl, can someone tell me the &#num; for that >> sign. The one
Hey guys I have an older site that is coded in AS2(I can't get
Hey guys, I'm wondering can someone help me out. I'm using javascript to serialize
Hey, hope someone can help with this.. How can I get the previous ID
Can someone help me: $pattern = /^(?:[a-zA-Z0-9?. ]?)+@([a-zA-Z0-9]+)(.+)?$/; $str = Hey @[14256] hey how
Hey, can someone help me make this an object please. Obviously not all my
Hey Guys! Me again! Can someone provide me with some example code of how
Hey can anyone help me understand how to do an edit method for my

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.