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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:14:53+00:00 2026-05-26T08:14:53+00:00

Im making a small python script for auto logon to a website. But i’m

  • 0

Im making a small python script for auto logon to a website. But i’m stuck.

I’m looking to print into terminal a small part of the html, located within this tag in the html file on the site:

<td class=h3 align='right'>&nbsp;&nbsp;John Appleseed</td><td>&nbsp;<a href="members_myaccount.php"><img border=0 src="../tbs_v7_0/images/myaccount.gif" alt="My Account"></a></td>

But how do I extract and print just the name, John Appleseed?

I’m using Pythons’ Mechanize on a mac, by the way.

  • 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-26T08:14:54+00:00Added an answer on May 26, 2026 at 8:14 am

    Mechanize is only good for fetching the html. Once you want to extract information from the html, you could use for example BeautifulSoup. (See also my answer to a similar question: Web mining or scraping or crawling? What tool/library should I use?)

    Depending on where the <td> is located in the html (it’s unclear from your question), you could use the following code:

    html = ... # this is the html you've fetched
    
    from BeautifulSoup import BeautifulSoup
    
    soup = BeautifulSoup(html)
    # use this (gets all <td> elements)
    cols = soup.findAll('td')
    # or this (gets only <td> elements with class='h3')
    cols = soup.findAll('td', attrs={"class" : 'h3'})
    print cols[0].renderContents() # print content of first <td> element
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making a small python script to upload files on the net. The script
The particular alias I'm looking to class up into a Python script happens to
I am going to be making a small user system but I have questions.
I'm making a small project in Google AppEngine but I'm having problems with international
I'm making a small Python program, which calls the webbrowser module to open a
I am in the process of writing a small(er) Python script to automate a
I'm making a small ruby command line script and I wanted to know what
I'm making a small python game with pygame. I'd like to be able to
I'm working on making a small Python module. I want this module to return
I've been making small scale projects for a while now. I haven't started a

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.