[Tutor] Using urllib to retrieve info

David Holland davholla2002 at yahoo.co.uk
Mon Aug 8 18:53:16 CEST 2005


Kent,

Sorry I should have put my code.
This is what I wrote
import urllib
import urllib2
f =
urllib.urlopen("http://support.mywork.co.uk/index.php?node=2371&pagetree=&fromid=20397&objectid=21897").read()
newfile = open("newfile.html",'w')
newfile.write(f)
newfile.close()
print 'finished'

It runs fine but the file saved to disk is the
information at : 'http://support.mywork.co.uk'
not
'http://support.mywork.co.uk/index.php?node=2371&pagetree=&fromid=20397&objectid=21897"'
(By the way the real url is
http://support.mywork.co.uk
as I don't what my boss to know I am doing this, in
case I can't not get it to work, in which case he will
say a waste of time.  Of course if I do get it to work
it will not be a waste of time).


The bizarre thing is that for an address like :-
'http://www.linuxquestions.org/questions/showthread.php?s=&threadid=316298'.

It works okay.

Does that make sense.
Thanks everyone for the help so far.


	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


More information about the Tutor mailing list