Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 11th, 2012, 02:30 PM
dannyike93 dannyike93 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 1 dannyike93 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 20 sec
Reputation Power: 0
Extracting a table from the Web

Hey!

I have recently begun learning computer programming using the Python language (using Python 2.5.4). I use Mac OS X. Amidst my learning, I have been assigned the task to extract a web table, which I will specify in a second, using Python programming and convert it into a format that is readable by (can be placed neatly and directed into) Microsoft Excel.

The link below has one table with statistics about the National Hockey League (NHL).

nhl.com/ice/gamestats.htm?season=20112012&gameType=2&team=&viewName=summary

I have been reading about ways to complete the task, but I realize that people with much more experience using Python may be able to help me more than the books.

If anyone has a code that is designed to do just this and can be adjusted to the particular website that I need to work with, provide any helpful and guiding knowledge in generating the code, or even texts which I can read that will help me write the code, that would be greatly appreciated! Thanks in advance!

Reply With Quote
  #2  
Old July 11th, 2012, 03:52 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,384 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 13 h 48 m 49 sec
Reputation Power: 383
Looks like there are several tables on that page. Five tables? (search the page source for "<table")
The most obvious one says that it shows rows 1-30 of 1230 results. Do you need all 1230?

You might try the python csv library module to write a file that excel can read.

The python libraries also are packed with html functionality. There could be a reader that, as one of its features, identifies tables. I myself would do something stupid like write my own code to parse the page source, find the table rows <tr>blah blah blah </tr>
where the stuff in between is table data <td>information</td>
but hey, that may account for my being unemployed.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Extracting a table from the Web

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap