python读取如1 02917930254704324 0022895137821592182 -008114470668959266 -00588472702240990943 -10063152208304178 -014003678801063594 2137262707595156 011466382142044017形式的200个坐标点写为200个array
您可以使用以下代码将给定的坐标点写为200个数组:
coordinates = []
with open('file.txt', 'r') as file:
for line in file:
data = line.split()
point = [int(data[0]), float(data[1]), float(data[2])]
coordinates.append(point)
arrays = [array(point) for point in coordinates]
请确保将file.txt替换为包含坐标点的实际文件名。这将创建一个包含200个数组的arrays列表,其中每个数组包含一个坐标点的三个值。
原文地址: https://www.cveoy.top/t/topic/h8fu 著作权归作者所有。请勿转载和采集!