我将此代码放在名为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'