我正在创建一个程序,在这个程序中,我想提示用户选择纽约市行政区,并使用该行政区的通用GPS坐标。我的部分代码是
df.loc[0,'BOROUGH'] = input('Borough:\n')
manhattan = [40.7831, -73.9712]
brooklyn = [40.6782, -73.9442]
staten_island = [40.5795, -74.1502]
queens = [40.7282, -73.7949]
bronx = [40.8448 ,-73.8648]
现在我想使用输入响应来访问适当的坐标。例如,如果用户输入“Manhattan”,我可以使用input().lower()
的一些变体来获取相应的自治区数据
从this answer中我知道,如果我想使用输入创建变量,我可以这样做。是否有方法访问变量
这是从给定用户输入的集合中拾取某些数据的一种方法:
相关问题 更多 >
编程相关推荐