所以,我有一个非常大的数字,我正在用 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?
int
和 long
都适用于此
>>> a
3.101541146879488e+80
>>> int(a)
310154114687948792274813492416458874069290879741385354066259033875756607541870592L
>>> long(a)
310154114687948792274813492416458874069290879741385354066259033875756607541870592L
>>> print (int(a))
310154114687948792274813492416458874069290879741385354066259033875756607541870592
>>> print (long(a))
310154114687948792274813492416458874069290879741385354066259033875756607541870592
这篇关于如何在python中打印一个大数的所有数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!