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 8749835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:45:39+00:00 2026-06-13T12:45:39+00:00

Assume the following is a subset of the HTML document… note there are multiple

  • 0

Assume the following is a subset of the HTML document… note there are multiple tables that repeat, though the <a name="1"> may be “2”, “3” , “4”, etc. with different text for each table.

<table align="center" width="550">
<tr>
<td valign="top" width="300"><b>Product:</b></img></td>
<td>
<a name="1"></a>1) Text Editor
<p>An application for the editing of text files.</p>
<br>
<b>Application Name: Notepad</b>
<br>            
<b>Type: Writing</b>
<br><br></td>
</tr>
</table>

I want to be able to find an “a” tag that equals a particular “#” (in this case, 1)
and be able to somehow get the text of: “1) Text Editor”.

I know if I beautifulsouped the whole document I can use something like findAll("table") to give me all the tables, but I do not know how I can possibly get to that value. I may be able to do something like findAll("a"), but how would I specify the “name” to be equal to (1 in this case)? Even if I could do that, I wouldnt be able to get to the “1) Text Editor” since that “a” tag is empty.. and I also couldnt get to things like the “<b>Application Name: Notepad</b>” part.

What is the best solution with a combination of python/beautifulsoup, or if there is some better way to get that “1) Text Editor” and “Application Name” and “Type” parts of the table out based on the fact that there is a <a name="1"></a> that precedes it? Sample syntax would be great.

  • 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-13T12:45:39+00:00Added an answer on June 13, 2026 at 12:45 pm

    You can specify attributes with findAll …

    >>> a = soup.findAll("a", attrs={"name": "1"})[0]
    

    … and then get the next node …

    >>> a.next
    u'1) Text Editor\n'
    

    … and the next <b> element …

    >>> a.findNext("b")
    <b>Application Name: Notepad</b>
    

    … and so on.

    By the way, the attrs argument is only necessary because name is a special argument to findAll(). If it had been some other attribute, you could have used e.g.

    >>> a = soup.findAll("a", href="whatever")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume the following tables: TABLE: foo ========================= | foo_id | fk_id | name |
Assume the following scenario: All data are in Sql Server tables. 1) An Execute
Assume the following function prototype: void *function(int arg) . Is that a pointer to
Assume that the following Perl code is given: my $user_supplied_string = &retrieved_from_untrusted_user(); $user_supplied_string =~
Assume the following model. Note the self-referencing relationship parent. class Widget(object): __tablename__ = 'widgets'
Let's assume there is a SQL Server 2008 table like below, that holds 10
Assume the following is a 2d array that we are operating on a b
Assume the following association among three tables in a database: //working with three tables
Assume the following mapping entries: < class name=Customer table=customer> <id name=InternalId column=uintCustomerId type=long> <generator
I am having few excel files where each file have multiple workbooks. Assume following

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.