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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:20:21+00:00 2026-06-03T03:20:21+00:00

My HTML : <table cellspacing=0 cellpadding=2 rules=all border=1 id=branchTable width=100%> <tr class=TitleTable> <th scope=col

  • 0

My HTML :

            <table cellspacing="0" cellpadding="2" rules="all" border="1" id="branchTable" width="100%">
            <tr class="TitleTable">
                <th scope="col" width="250"><b>Branch Name</b></th><th scope="col" width="35%"><b>Branch Date</b></th><th scope="col" width="35%"><b>Branch Origin</b></th>
            </tr><tr class="RowSet">
                <td><a class="blue" href="javascript: OpenWindow(&#39;/home/data/files/fetchRecord.php?fileID=342&#39;)">SFO Branch</a></td><td class="red">03/16/2012</td><td class="red">&nbsp;</td>
            </tr><tr class="RowSet">
                <td><a class="blue" href="javascript: OpenWindow(&#39;/home/data/files/fetchRecord.php?fileID=884&#39;)">LAX Branch</a></td><td class="red">03/16/2012</td><td class="red">06/16/1985</td>
            </tr><tr class="RowSet">
                <td><a class="blue" href="javascript: OpenWindow(&#39;/home/data/files/fetchRecord.php?fileID=83&#39;)">DC Branch</a></td><td class="red">03/16/2012</td><td class="red">&nbsp;</td>
            </tr>
            </table>

My Code so far :

from BeautifulSoup import BeautifulSoup

soup = BeautifulSoup(pageSource)
table = soup.find("table", id = "branchTable")
rows = table.findAll("tr", {"class":"RowSet"})

data = [[td.findChildren(text=True) for td in tr.findAll("td")] for tr in rows]
print data

Output :

SFO Branch  03/16/2012  &nbsp;
LAX Branch  03/16/2012  06/16/1985
DC Branch   03/16/2012  &nbsp;

Desired :

I would like to grab the data enclosed in the tags as well as the ID (fetchRecord.php?fileID=342) . Not sure how to fetch that value. BeautifulSoup or Regex, please help. Thanks!

  • 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-03T03:20:22+00:00Added an answer on June 3, 2026 at 3:20 am

    You can use a regex to parse the href but I was too lazy to write one. See href_parse below for the proper way to parse a query string after retrieving the URI:

    from urlparse import urlparse
    from urlparse import parse_qs
    
    def href_parse(value):
        if (value.startswith('javascript: OpenWindow(&#39;') and 
            value.endswith('&#39;)'):
            begin_length = len('javascript: OpenWindow(&#39;')
            end_length = len('&#39;)')
            file_location = value[begin_length:-end_length]
    
            query_string = urlparse(file_location).query
            query_dict = parse_qs(query_string)
            return query_dict.get('fileId', None)
    
    
    href_data = [[href_parse(td.find('a', attrs={'class': 'blue'})['href']) 
                  for td in tr.findAll("td")] 
                  for tr in rows]
    print href_data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CSS table tr {border-bottom:1px solid #008999} HTML <table width=100% cellspacing=0 cellpadding=0> <thead> <tr> <th
I built an HTML table: <table cellpadding=0 cellspacing=0 border=0 style=width:1000px id=maintable> <thead> <tr> <th
This is what my HTML looks like : <table cellspacing=0 cellpadding=0 class=list04 style=width:704px;> <td
I have a previous html code. <table width=600px cellspacing=0 border=1 id=mainTable> <tr> <th> Name
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
In an HTML table, the cellpadding and cellspacing can be set like this: <table
I have a program-generated HTML file, and this tag is repeating: <table cellspacing=0 cellpadding=0
<table cellpadding=1 cellspacing=1 id=member><thead> <tr> <th>&nbsp;</th> <th>Gracz</th> <th>Ludność</th> <th>Osady</th><th>&nbsp;</th></tr></thead><tbody><tr> <td class=ra>1.</td><td class=pla><a href=spieler.php?uid=5473>rafal12</a></td><td class=hab>8801</td>
Here's my Haml code: %html %head %body %table {'width' => 638, 'border' => 0,

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.