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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:41:37+00:00 2026-06-01T13:41:37+00:00

I am trying to read some data from a python module from a web.

  • 0

I am trying to read some data from a python module from a web.

I manage to read, however having some difficulty in parsing this data and getting the required information.

My code is below. Any help is appreciated.

#!/usr/bin/python2.7 -tt

import urllib
import urllib2

def Connect2Web():
  aResp = urllib2.urlopen("https://uniservices1.uobgroup.com/secure/online_rates/gold_and_silver_prices.jsp");
  web_pg = aResp.read();

  print web_pg

#Define a main() function that prints a litte greeting
def main():
  Connect2Web()

# This is the standard boilerplate that calls the maun function.
if __name__ == '__main__':
    main()

When I print this web page I get the whole web page printed.

I want to extract some information from it, (e.g. "SILVER PASSBOOK ACCOUNT" and get the rate from it), I am having some difficulties in parsing this html document.

  • 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-01T13:41:38+00:00Added an answer on June 1, 2026 at 1:41 pm

    It’s possible to use regexps to get required data:

    import urllib
    import urllib2
    import re
    
    def Connect2Web():
      aResp = urllib2.urlopen("https://uniservices1.uobgroup.com/secure/online_rates/gold_and_silver_prices.jsp");
      web_pg = aResp.read();
    
      pattern = "<td><b>SILVER PASSBOOK ACCOUNT</b></td>" + "<td>(.*)</td>" * 4
      m = re.search(pattern, web_pg)
      if m:
        print "SILVER PASSBOOK ACCOUNT:"
        print "\tCurrency:", m.group(1)
        print "\tUnit:", m.group(2)
        print "\tBank Sells:", m.group(3)
        print "\tBank Buys:", m.group(4)
      else:
        print "Nothing found"
    

    Don’t forget to re.compile the pattern if you are doing your matches in loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to read in some sample data from an XML file in a
I'm getting something pretty strange going on when trying to read some data using
I'm new to Python and I'm trying to read some values from an USB
i am trying to read in some data from an excel: If (FileUpload1.PostedFile.ContentType =
Im trying to read some data from a binary file into a buffer allocated
Using Python (3.1 or 2.6), I'm trying to read data from binary data files
Hello I'm trying to read some data from the serial port and record it
I am trying to read some data from a xml file, numbers are saved
I'm trying to measure how long it takes read then encrypt some data (independently).
I am trying to read some settings from php.ini using zend. The API that

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.