我需要把坐标数据转换成十进制格式。
我在模块的开头使用# -*- coding: utf-8 -*- #
。你知道吗
原始文件中的数据行:
06:58 15:07:26 -53°08'00.7" -70°51'27.5" 2404.1 746.1 -2.4 22.3 0.3675
当处理文件并消除空格并使用查找器写入其他文件时,行为:
06:58 15:07:26 -53∞08'00.7" -70∞51'27.5" 2404.1 746.1 -2.4 22.3 0.3765
我需要将-53°08'00.7"
转换成十进制格式-gg,ddddd
。
但我不明白,因为在Spyder中是正确的,但在finder中不是。有什么提示吗?
这是代码的一部分:
if os.path.exists(name):
with open(name, 'r', encoding="utf-8", errors="surrogateescape") as f:
for line in itertools.islice(f, 2, None): # start=2, stop=None
if not '//' in line:
linea1 = re.sub('[ \t]+' , ' ', line)
signo = linea1.find('-',0,6)
if signo == -1 :
file_mov.write(linea1)
看看下面的方法是否有用。它不优雅,但它应该给你一个什么是正在发生的好主意。你知道吗
输出:
相关问题 更多 >
编程相关推荐