Python 3.6 uszipcode打印半径内的zipCode

Python 3.6 uszipcode打印半径内的zipCode,python,anaconda,geo,zipcode,Python,Anaconda,Geo,Zipcode,我试图返回另一个邮政编码10英里半径内的邮政编码值。我正在使用ZipCodeSearchAngine返回正确的值,我还以为它是在返回一个字典,但是如何在Mac上使用anaconda和Python 3.6以res.的形式打印Zipocde值。如果你有任何问题,请告诉我。代码和返回值如下 from uszipcode import ZipcodeSearchEngine search = ZipcodeSearchEngine() area = search.by_zipcode("10001")

我试图返回另一个邮政编码10英里半径内的邮政编码值。我正在使用ZipCodeSearchAngine返回正确的值,我还以为它是在返回一个字典,但是如何在Mac上使用anaconda和Python 3.6以res.的形式打印Zipocde值。如果你有任何问题,请告诉我。代码和返回值如下

from uszipcode import ZipcodeSearchEngine
search = ZipcodeSearchEngine()
area = search.by_zipcode("10001")
Lat = area['Latitude']
Long = area['Longitude']
print('This is the Longitude:'+ ' ' + str(Long))
print('This is the Latitude:'+ ' ' + str(Lat))

res = search.by_coordinate(Lat, Long, radius=10, returns=5)
print(res)
inp = input("Select key to print value for!")
if inp in res:
  print(res[inp])


[{"City": "New York", "Density": 34035.48387096774, "HouseOfUnits": 12476, 
"LandArea": 0.62, "Latitude": 40.75368539999999, "Longitude": -73.9991637, 
"NEBoundLatitude": 40.8282129, "NEBoundLongitude": -73.9321059, "Population": 
 21102, "SWBoundLatitude": 40.743451, "SWBoungLongitude": -74.00794499999998, 
 "State": "NY", "TotalWages": 1031960117.0, "WaterArea": 0.0, "Wealthy": 
 48903.42702113544, "Zipcode": "10001", "ZipcodeType": "Standard"}, {"City": 
"New York", "Density": 300.0, "HouseOfUnits": 1, "LandArea": 0.03, 
"Latitude": 40.751776899999996, "Longitude": -73.9965928, "NEBoundLatitude": 
40.752722799999994, "NEBoundLongitude": -73.993948, "Population": 9, 
"SWBoundLatitude": 40.749553000000006, "SWBoungLongitude": -74.0084871, 
"State": "NY", "TotalWages": null, "WaterArea": 0.0, "Wealthy": null, 
"Zipcode": "10199", "ZipcodeType": "Standard"}, {"City": "New York", 
"Density": 16340.625, "HouseOfUnits": 4425, "LandArea": 0.32, "Latitude": 
40.755322, "Longitude": -73.9932872, "NEBoundLatitude": 40.7648468, 
"NEBoundLongitude": -73.98088800000001, "Population": 5229, "SWBoundLatitude": 
40.749724, "SWBoungLongitude": -74.0124001, "State": "NY", "TotalWages": 
810026753.0, "WaterArea": 0.0, "Wealthy": 154910.45190284948, "Zipcode": 
"10018", "ZipcodeType": "Standard"}, {"City": "New York", "Density": 4600.0, 
"HouseOfUnits": 0, "LandArea": 0.02, "Latitude": 40.7502013, "Longitude": 
-73.9931036, "NEBoundLatitude": 40.75219, "NEBoundLongitude": -73.990623, 
"Population": 92, "SWBoundLatitude": 40.74910089999999, "SWBoungLongitude": 
-73.994844, "State": "NY", "TotalWages": null, "WaterArea": 0.0, "Wealthy": 
null, "Zipcode": "10119", "ZipcodeType": "Standard"}, {"City": "New 
York","Density": 56161.36363636363, "HouseOfUnits": 17958, "LandArea": 0.44, 
"Latitude": 40.7602619, "Longitude": -73.9932872, "NEBoundLatitude": 
40.768738, "NEBoundLongitude": -73.9781161, "Population": 24711, 
"SWBoundLatitude": 40.723624900000004, "SWBoungLongitude": -74.004786, 
"State": "NY", "TotalWages":1686575064.0, "WaterArea": 0.0, "Wealthy": 
68251.99562947675, "Zipcode": "10036","ZipcodeType": "Standard"}]

正如Cubic所指出的,这个问题还不清楚。然而,我假设您想要打印zipcode,而不是城市的所有细节。您假设search.by_coordinarelate,Long,radius=10,returns=5是错误的。它返回一个列表。您始终可以使用typeres检查python中变量的类型。我还假设用户应该选择一个数字作为输入。当您得到res[inp]时,您会得到输入的一个元素,即字典。您可以使用该键从该元素获取zipcode。修改代码如下:

if inp in res:
    print(res[inp]['Zipcode'])

等等,问题是什么?我怎么打印出名单上的区号?