If you are using Python2 ...
import urllib
pagetext = urllib.urlopen("http://www.python.org").read()
print pagetext
For Python3 use ...
import urllib.request
pagetext = urllib.request.urlopen("http://www.python.org").read()
print(pagetext)
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
Strange ...
import urllib
pagetext = urllib.urlopen("http://www.python.org").read()
print pagetext
... works just fine with Python 2.5.4
You could try the improved version ...
import urllib2
pagetext = urllib2.urlopen("http://www.python.org").read()
print pagetext
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
No errors to me too (Vega's version)
Check your python installation
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
It could be the way 'Your_mum' is connected to the internet, maybe there is a filter or firewall somewhere. After all, 'www.Python.com' is a porn site.
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417