度分秒转化为十进制度的python代码

更新时间:2023-07-27 03:11:34 阅读: 评论:0

方法的拼音度分秒转化为十进制度的python代码
If you want to handle negatives properly, the first non-zero measure is t negative.孝庄皇后和多尔衮欧美女歌星如果要正确处理负数,则将第一个非零度量设置为负数。It is counter to mon practice to specify all of degrees, minutes and conds as negative ( Wikipedia shows 40° 26.7717, -79° 56.93172 as a valid example of degrees-minutes notation, in which degrees are negative and minutes have no sign), and tting degrees as negative does not have any effect if the degrees portion is 0. Here is a function that adequately handles this, bad on Paul McGuire's and baens' functions:将所有度数、分钟数和秒数指定为负数是违反惯例的( 维基百科显示 40° 26.7717、-79° 56.93172 作为度数-分钟符号的有效示例,其中度数为负数,分钟数没有符号),如果度数部分为 0,则将度数设置为负数没有任何效果。这是一个充分处理此问题的函数,基于 Paul McGuire 和 baens 的函数:
def decdeg2dms(dd):狼乐园
    negative = dd < 0
马家荡
    dd = abs(dd)
    minutes,conds = divmod(dd*3600,60)
    degrees,minutes = divmod(minutes,60)
    if negative:
        if degrees > 0:
            degrees = -degrees
        elif minutes > 0:
无垠地平线            minutes = -minutes中甲积分榜
        el:
            conds = -conds
    return (degrees,minutes,conds)
小学美术听课记录

本文发布于:2023-07-27 03:11:34,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1098125.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:负数   度数   没有   符号   设置   记录
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图