[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

regarding html source code

jainshasha

2/11/2008 5:17:00 PM

hello friends

well i have create a program which can read out the html source code
files or any other web page source code files through my program so
please guys help me out in this problem that how python can help me in
this regard and if there is any other language through which i can
easily make my program


Thanks in advance

3 Answers

Stefan Behnel

2/11/2008 5:46:00 PM

0

jainshasha wrote:
> well i have create a program which can read out the html source code
> files or any other web page source code files through my program so

Like this?

>>> from lxml import html
>>> page = html.parse("http://www.google...)
>>> print page.find("//title").text
Google

http://codespea...

Stefan

Stefan Behnel

2/11/2008 6:06:00 PM

0

Hi,

shashank jain top-posted:
> On Feb 11, 2008 11:15 PM, Stefan Behnel <stefan_ml@behnel.de> wrote:
>
>> jainshasha wrote:
>>> well i have create a program which can read out the html source code
>>> files or any other web page source code files through my program so
>> Like this?
>>
>> >>> from lxml import html
>> >>> page = html.parse("http://www.google...)
>> >>> print page.find("//title").text
>> Google
>>
>> http://codespea...
>>
> well i would like to know how python can help me in doing this or if u think
> any other language please help me out

What I showed you was Python code that reads an HTML file. What else do you need?

Stefan

subeen

2/11/2008 6:19:00 PM

0

Another way:

import urllib2

usock = urllib2.urlopen('http://ab...)
data = usock.read()
usock.close()

print data




On Feb 12, 12:05 am, Stefan Behnel <stefan...@behnel.de> wrote:
> Hi,
>
> shashank jain top-posted:
>
>
>
> > On Feb 11, 2008 11:15 PM, Stefan Behnel <stefan...@behnel.de> wrote:
>
> >> jainshasha wrote:
> >>> well i have create a program which can read out the html source code
> >>> files or any other web page source code files through my program so
> >> Like this?
>
> >> >>> from lxml import html
> >> >>> page = html.parse("http://www.google...)
> >> >>> print page.find("//title").text
> >> Google
>
> >>http://codespea...
>
> > well i would like to know how python can help me in doing this or if u think
> > any other language please help me out
>
> What I showed you was Python code that reads an HTML file. What else do you need?
>
> Stefan