i have python 2.7.10 on windows 7. urllib works in idle shell no problem, when run exact same code lets file, or python urltest.py
my code:
import urllib page = urllib.urlopen("http://www.google.com") contents = page.read() print contents i following error:
page = urllib.urlopen("http://www.google.com") attributeerror: 'module' object has no attribute 'urlopen' keep in mind exact code works in idle shell (shell, not editor)
i suggest default python version 3, no longer has urllib.urlopen (it uses urllib.request.urlopen).
idle using 2.7.
Comments
Post a Comment