defdms2dd(dms): """ convert degree minute second to degree decimal :param dms:度分秒/度分 形式的经纬度 :return: """ dms = dms.strip() a = re.findall('[^\\d°\'"″NSEWΕ\\.]', dms) if a : print('有异体字符') print(a) print('该异体字ASCII是') print([ord(x) for x in a]) parts = re.split('[°\'"″]+', dms) degree, minute, second, direction = 0, 0, 0, 0 iflen(parts) == 3: degree, minute, direction = parts eliflen(parts) == 4: degree, minute, second, direction = parts dd = float(degree) + float(minute) / 60 + float(second) / (60 * 60) if direction == 'W'or direction == 'S': dd *= -1 else: if direction == 'E'or direction == 'N'or direction == 'Ε'or direction == 'Ν': dd *= +1 return dd