-3
我在Linux上使用Python 3.4.2這裏是我的代碼。Python urllib無法打開本地主機
myurl = 'http://localhost/test.php'
response = urllib.urlopen(myurl)
while response.text != 'exit':
response = urllib.urlopen(myurl)
,我得到這個錯誤
Traceback (most recent call last) :
File "/var/www/html/led.py", line 19, in <module>
response = urllib.urlopen(myurl)
AttributeError: 'module' object has no attribute 'urlopen'
['urllib.request.urlopen'](https://docs.python.org/3/library/urllib.request.html#module-urllib.request) 3 –