[英]How to produce a very large number in python?
I tried making it utilizing exponents, but the pow()
function starts giving errors at after a certain size. 我尝试利用指数使其变大,但
pow()
函数在达到一定大小后开始产生错误。 I need an integer about 6 million digits long. 我需要一个约600万位数的整数。 Either that or a string of numbers works too.
那个或一串数字也可以。 It can't be infinity though, because I need it for string manipulation.
但是它不能是无限的,因为我需要它来进行字符串操作。
size_of_number = 6000000
s = "".join(random.choice("0123456789") for _ in xrange(size_of_number))
doesnt work? 不起作用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.