Python 如何在数组中查找导入文件的距离

Python 如何在数组中查找导入文件的距离,python,arrays,distance,Python,Arrays,Distance,我知道如何打印出所需的信息数组,知道如何使用经度和纬度计算距离,但我不确定如何将数据导入距离函数 from datetime import datetime # Use 2 different longitude and latitude to calculate distance # preferably distance in meters # Use distance and time to calculate speed preferably m/s # m/s -> mph

我知道如何打印出所需的信息数组,知道如何使用经度和纬度计算距离,但我不确定如何将数据导入距离函数

from datetime import datetime

# Use 2 different longitude and latitude to calculate distance
# preferably distance in meters

# Use distance and time to calculate speed preferably m/s

# m/s -> mph


file = open('info.txt', 'r')
lines = file.readlines()


array = []

counter = 0
for line in lines:
    dictionary = ast.literal_eval(line)
    array.append(dictionary)
    counter += 1
    if counter >= 4:
        break

print(array)


#import math
#R = 6373.0
#lat1 = math.radians()
#lon1 = math.radians()
#lat2 = math.radians()
#lon2 = math.radians()

#dlon = lon2 - lon1
#dlat = lat2 - lat1

#a = math.sin(dlat / 2)**2 + math.cos(lat1)
#c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
#distance = R * c
#print(distance)
如何将这两者结合起来以打印出所需的输出