location = geolocator.geocode(" ".join(address.values()))
if location.longitude is not None:
node['pos'] = [location.longitude, location.latitude]
不明白我仍然收到此错误:
File "/home/easypc/Documents/Udacity_nano_degree/Data_Wrangling/audit_vilnius.py", line 167, in shape_element
if location.longitude is not None:
AttributeError: 'NoneType' object has no attribute 'longitude'
请您参考如下方法:
是 location 变量本身是 None,也对其进行测试:
if location is not None and location.longitude is not None:
或者更简单地说:
if location:
