Getting the source of a remote webpage

R

Ryan Kaskel

Is it possible to get the source of a remote webpage (just the
straight HTML) without anything too complicated (like COM, I just want
to write a simple script if possible) and write it to a file? For
example, is it possible to do something like os.system(....run
iexplorer.exe command....) with another command that automatically
opens the page? Thanks.

Ryan Kaskel
 
N

Nugget

Is it possible to get the source of a remote webpage (just the
straight HTML) without anything too complicated (like COM, I just want
to write a simple script if possible) and write it to a file? For
example, is it possible to do something like os.system(....run
iexplorer.exe command....) with another command that automatically
opens the page? Thanks.

import urllib

f = urllib.urlopen(url)
s = site.read()
 
G

Grant Edwards

import urllib

f = urllib.urlopen(url)
s = site.read()

least we lead the gentle reader astray...

Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'site' is not defined

What you meant was:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
[...]
 
R

Ryan Kaskel

Nevermind....a simple look in the Standard Library gave me the simple
solution I needed....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top