V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
panghua
V2EX  ›  问与答

请问在 python3 中如何将 string 类型转换为 decimal.Decimal 类型?

  •  
  •   panghua · 2018 年 8 月 21 日 · 4283 次点击
    这是一个创建于 2722 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在 python3 中如何将 string 类型转换为 decimal.Decimal 类型

    3 条回复    2018-11-12 17:31:05 +08:00
    edsion996
        1
    edsion996  
       2018 年 8 月 21 日
    panghua
        2
    panghua  
    OP
       2018 年 8 月 22 日
    谢谢!
    tqknight
        3
    tqknight  
       2018 年 11 月 12 日
    import decimal

    dec = decimal.Decimal('0.123456')
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1245 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:39 · PVG 01:39 · LAX 09:39 · JFK 12:39
    ♥ Do have faith in what you're doing.