hi,all
if the html like:
<meta name = "description" content = "a test page">
<meta name = "keywords" content = "keyword1 keyword2">
if i use:
def handle_starttag(self, tag, attrs):
if tag == 'meta':
self.attr = attrs
self.headers += ['%s' % (self.attr)]
self.attr = ''
will get the output:
[('name', 'description'), ('content', 'a test page')]
[('name', 'keywords'), ('content', 'keyword1 keyword2')]
is it some way that only take the content like " a test page, keyword1
, keywork2" 1 1189
cheng wrote: hi,all
if the html like: <meta name = "description" content = "a test page"> <meta name = "keywords" content = "keyword1 keyword2">
if i use: def handle_starttag(self, tag, attrs): if tag == 'meta': self.attr = attrs self.headers += ['%s' % (self.attr)] self.attr = ''
will get the output: [('name', 'description'), ('content', 'a test page')]
[('name', 'keywords'), ('content', 'keyword1 keyword2')]
is it some way that only take the content like " a test page, keyword1 , keywork2"
And put it where ?-)
Well, it may looks like this:
def handle_starttag(self, tag, attrs):
if tag == 'meta':
try:
self.content.append(attrs['content'])
except KeyError:
pass
self.headers += ['%s' % attr]
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mitchua |
last post by:
When I run the well quoted line:
my $ascii =
HTML::FormatText->new->format(HTML::Parse::parse_html($html));
to remove HTML tags from an html document, it replaces all tables with
"". Is there a...
|
by: joseph.inglis |
last post by:
I have a web browser object on a form which I have set to edit mode and use
the UCOMIConnectionPointContainer interface to hook in and catch events.
All working sweetly.
Except there...
|
by: anupamjain |
last post by:
Hi,
After 2 weeks of search/hit-and-trial I finally thought to revert to
the group to find solution to my problem.(something I should have done
much earlier)
This is the deal :
On a JSP...
|
by: Rob Meade |
last post by:
Hi all,
I'm working on a project where there are just under 1300 course files, these
are HTML files - my problem is that I need to do more with the content of
these pages - and the thought of...
|
by: Jason |
last post by:
First things first, let me say that I couldn't decide whether to post
this to the PHP ng, or to an XML ng. I know from experience that you
guys know what you're talking about, though, and all of...
|
by: DH |
last post by:
Hi,
I'm trying to strip the html and other useless junk from a html page..
Id like to create something like an automated text editor, where it
takes the keywords from a txt file and removes them...
|
by: june |
last post by:
Hi,
I have a big problem with parsing HTML into a XHTML using Cberneko to validate the html.
First I tried to work with a HTML-File. This solutions works fine:
String aHTMLFile =...
|
by: moddster |
last post by:
Hi Guys. I am a newbie to perl and need some help with a problem.
PROBLEM: I have to parse an HTML file and get rid of all the HTML tags and count the number of sumbissions a person has through...
|
by: lxyone |
last post by:
Using a flat file containing table names, fields, values whats the
best way of creating html pages?
I want control over the html pages ie
1. layout
2. what data to show
3. what controls to...
|
by: Steve Swift |
last post by:
I have a page that accepts user input, including HTML. I would like to
offer a preview of what the users HTML will look like, but I'd also like
to avoid having to parse their HTML to ensure that it...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |