二本正经的胡说八道
2016-10-12 15:30
from urllib import request
resp = request.urlopen("http://www.baidu.com")
print (resp.read)
----------------------------------------------------
Traceback (most recent call last):
File "E:\Java\eclipse-java-neon-1-win32-x86_64\eclipse\test_eclipse\cada\test\test1.py", line 8, in <module>
from urllib import request
ImportError: cannot import name request
百度后有人说用import selenium print selenium,__init__这句话找到selenium的文件并把它删除,但是运行这句话时又报错了
File "E:\Java\eclipse-java-neon-1-win32-x86_64\eclipse\test_eclipse\cada\test\test1.py", line 8
import selenium print selenium,__init__
^
SyntaxError: invalid syntax
求解。。。。
已解决!参考python文档的urllib页
import urllib2
req = urllib2.Request('http://www.voidspace.org.uk')
response = urllib2.urlopen(req)
the_page = response.read()
python 2.7
python遇见数据采集
59669 学习 · 200 问题
相似问题