csv_get_location.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:python 作者: micronicstraining 项目源码 文件源码
def main():
    """ Only step 1 is given as solution. """
    with open(FILE_NAME, newline='') as csv_file:
        geo_locator = Nominatim()
        csv_reader = csv.reader(csv_file, delimiter=DELIMITER)
        for record in csv_reader:
            # is this a better way of unpacking you can think of?
            # Perhaps using a better data structure than just a tuple?
            policy_id, *_, point_latitude, point_longitude, line, construction, point_granularity = record
            # print(policy_id, point_latitude, point_longitude)
            try:
                print(geo_locator.reverse(point_latitude + ', ' + point_longitude))
            except Exception as e:
                print(e)
                print("Unable to get reverse coordinates")

    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号