473,748 Members | 4,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extract Information from Tables in html

Dear all,

Here is a html code:

<td valign="top" headers="col4">

Premier Community Bank of Southwest Florida
<br />
Fort Myers, FL

</td>

My question is how I can extract the strings and get the results:
Premier Community Bank of Southwest Florida; Fort Myers, FL

Thanks a lot

Jackie
Sep 5 '08 #1
1 1510
Hi,

Jackie Wang wrote:
Here is a html code:

<td valign="top" headers="col4">

Premier Community Bank of Southwest Florida
<br />
Fort Myers, FL

</td>

My question is how I can extract the strings and get the results:
Premier Community Bank of Southwest Florida; Fort Myers, FL
Use lxml.html. Something like this should do what you want:
>>from lxml import html
tree = html.parse("htt p://server.org/thefile.html")
all_tds = tree.findall("//td")
for td in all_tds:
... print( td.xpath("norma lize-space()") )

Tweak as you see fit, tree iteration is at your service in case you need more.

http://codespeak.net/lxml/

Stefan
Sep 5 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1738
by: john | last post by:
I would like to develope a system using a web or non-web based client (FrontPage, Access, etc.) that can send requests to various travel web site (using our user name and password for each) and extract the requested pricing and information and compile it together for comparison. Can anyone suggest the best way to do this? I assumed XML would be the best way to do something like this but would the web site you are contacting not have to...
0
1625
by: Vjay77 | last post by:
I posted this question, but I pressed 'post' and it disappeared. So once again: Problem: I need to go to lets say www.site.com/page.html Imagine that this html code is 6 mb long. I need to extract information between bytes 5000 and 5020.
3
2456
by: rahman | last post by:
I have few hundred HTML pages. I need to extract portion of each HTML page into a text/database/HTML files format. You can imagine it is very tedious to do one by one. Is there any automatic process/software/tool available that could help me extract information form mass HTML files? I can specify what portion of file to take or leave. I have some tag like: <!--topic start-->
9
3501
by: chrisspencer02 | last post by:
I am looking for a method to extract the links embedded within the Javascript in a web page: an ActiveX component, or example code in C++/Pascal/etc. I am looking for a general solution, not one tailored to a particular page/script. Hopefully, the problem can be solved without recreating a complete Javascript interpreter. Any ideas?
2
12252
by: ameshkin | last post by:
This script I wrote works with tables, td's and div's, but not with style tags. Can anyone figure out the regular expression for finding <styletags. The trick is that sometimes its not just <style Its <style type="text/css"> Basically, i want to take the information in between the style content from any url <?php
1
2529
by: Prasad | last post by:
Hi, We have DB2 version 7 fixpak 14 on AIX 5.1. We have nicknames to another RDBMS tables. These nicknames have views and specification only indexes. I would like to know how we can extract the definition of these nicknames and related objects. db2look does not seem to have any option to extract this information. I tried the command "db2look -d <DB_NAME> -e". This does not return the nickname definitions.
2
2653
by: kimi | last post by:
Hi ppl, I am new to PHP. I would need some information on the following: 1. a) I wanted to know from where the data is extracted and stroed in the global assocoative arrays ( specifically what will be the contents of $_Session ?) b) Is there any way by which i can get to know all the keys of the arrays ( specifically what are the Keys of $_Session ?)
7
1740
by: aktar | last post by:
I have two related tables: 1) personal_details 2) company_details both having "ID" as a primary key I also have another table called mail. The mail table contains: MailID primary key
1
1619
by: Walter Cruz | last post by:
On Fri, Sep 5, 2008 at 11:29 AM, Jackie Wang <jackie.python@gmail.comwrote: Use BeautifulSoup. 's - Walter
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.