使用JSON时Python属性错误

时间:2016-11-08 17:09:43

标签: python python-2.7

我将此代码放在名为grab.py

的文件中
import urllib, json
url = "http://maps.googleapis.com/maps/api/geocode/json?address=googleplex&sensor=false"
response = urllib.urlopen(url)
data = json.loads(response.read())
print data

但是当我运行它时,我收到了这个错误:

File "grab.py", line 1, in <module>                                   

    import urllib, json
File "/home/cabox/workspace/json.py", line 3, in <module>             
AttributeError: 'module' object has no attribute 'loads'

0 个答案:

没有答案