推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
996bujiaban
V2EX  ›  Python

求解, Python 怎么保留大数

  •  
  •   996bujiaban · Nov 27, 2022 · 3841 views
    This topic created in 1445 days ago, the information mentioned may be changed or developed.

    如题 a=12345672644298357.857212458 print(a) 1.2345672644298358e+16

    a 会自动变成科学数,失去了后面的小数点

    用 int 或者 float 也会四舍五入

    目的是要用完整的 a 来进行计算

    4 replies  •  2022-11-27 20:51:02 +08:00
    BBCCBB
    BBCCBB
    Nov 27, 2022
    2
    decimal. java 里较 Bigdecimal
    Red998
    Red998
    Nov 27, 2022
    3
    字符串解决一切
    hefish
    hefish
    Nov 27, 2022
    4
    1#是正解。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2306 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 13:10 · PVG 21:10 · LAX 05:10 · JFK 08:10
    ♥ Do have faith in what you're doing.