如何在python中打印一个大数的所有数字?

2022-01-17 00:00:00 python numbers

问题描述

所以,我有一个非常大的数字,我正在用 python 计算,但是当我尝试打印它时,我得到了这样的结果:

So, I have a very large number that I'm working out in python, but when I try to print it I get something like this:

3.101541146879488e+80

如何打印我可爱号码的所有数字?

How do I print all the digits of my lovely number?


解决方案

intlong 都适用于此

>>> a
3.101541146879488e+80
>>> int(a)
310154114687948792274813492416458874069290879741385354066259033875756607541870592L
>>> long(a)
310154114687948792274813492416458874069290879741385354066259033875756607541870592L
>>> print (int(a))
310154114687948792274813492416458874069290879741385354066259033875756607541870592
>>> print (long(a))
310154114687948792274813492416458874069290879741385354066259033875756607541870592

相关文章