<i id='iuNDY'><tr id='iuNDY'><dt id='iuNDY'><q id='iuNDY'><span id='iuNDY'><b id='iuNDY'><form id='iuNDY'><ins id='iuNDY'></ins><ul id='iuNDY'></ul><sub id='iuNDY'></sub></form><legend id='iuNDY'></legend><bdo id='iuNDY'><pre id='iuNDY'><center id='iuNDY'></center></pre></bdo></b><th id='iuNDY'></th></span></q></dt></tr></i><div id='iuNDY'><tfoot id='iuNDY'></tfoot><dl id='iuNDY'><fieldset id='iuNDY'></fieldset></dl></div>

<small id='iuNDY'></small><noframes id='iuNDY'>

          <bdo id='iuNDY'></bdo><ul id='iuNDY'></ul>
        <legend id='iuNDY'><style id='iuNDY'><dir id='iuNDY'><q id='iuNDY'></q></dir></style></legend>

      1. <tfoot id='iuNDY'></tfoot>

        Python: Range() 最大尺寸;动态的还是静态的?

        时间:2023-11-08
        <i id='Rt2BC'><tr id='Rt2BC'><dt id='Rt2BC'><q id='Rt2BC'><span id='Rt2BC'><b id='Rt2BC'><form id='Rt2BC'><ins id='Rt2BC'></ins><ul id='Rt2BC'></ul><sub id='Rt2BC'></sub></form><legend id='Rt2BC'></legend><bdo id='Rt2BC'><pre id='Rt2BC'><center id='Rt2BC'></center></pre></bdo></b><th id='Rt2BC'></th></span></q></dt></tr></i><div id='Rt2BC'><tfoot id='Rt2BC'></tfoot><dl id='Rt2BC'><fieldset id='Rt2BC'></fieldset></dl></div>
        • <bdo id='Rt2BC'></bdo><ul id='Rt2BC'></ul>

          1. <tfoot id='Rt2BC'></tfoot>
            <legend id='Rt2BC'><style id='Rt2BC'><dir id='Rt2BC'><q id='Rt2BC'></q></dir></style></legend>
              <tbody id='Rt2BC'></tbody>
          2. <small id='Rt2BC'></small><noframes id='Rt2BC'>

                  本文介绍了Python: Range() 最大尺寸;动态的还是静态的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对 python 还是很陌生,所以我照常通过 Project Euler 来解决我脑海中的逻辑问题.

                  I'm quite new to python, so I'm doing my usual of going through Project Euler to work out the logical kinks in my head.

                  基本上,我需要尽可能大的列表大小,即 range(1,n),而不会溢出.

                  Basically, I need the largest list size possible, ie range(1,n), without overflowing.

                  有什么想法吗?

                  推荐答案

                  看看内置模块源码

                  总结:如果列表中的元素多于有符号长整数,您将收到溢出错误.在 32 位 Python 上是 2**31 - 1,在 64 位 Python 上是 2**63 - 1.当然,即使是低于该值的值,您也会收到 MemoryError.

                  Summary: You'll get an OverflowError if the list has more elements than can be fit into a signed long. On 32bit Python that's 2**31 - 1, and on 64 bit Python that's 2**63 - 1. Of course, you will get a MemoryError even for values just under that.

                  这篇关于Python: Range() 最大尺寸;动态的还是静态的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Python:将列表与范围列表合并 下一篇:弹出索引超出范围

                  相关文章

                  <legend id='5CrbQ'><style id='5CrbQ'><dir id='5CrbQ'><q id='5CrbQ'></q></dir></style></legend>

                    <small id='5CrbQ'></small><noframes id='5CrbQ'>

                    <tfoot id='5CrbQ'></tfoot>
                      <bdo id='5CrbQ'></bdo><ul id='5CrbQ'></ul>
                    <i id='5CrbQ'><tr id='5CrbQ'><dt id='5CrbQ'><q id='5CrbQ'><span id='5CrbQ'><b id='5CrbQ'><form id='5CrbQ'><ins id='5CrbQ'></ins><ul id='5CrbQ'></ul><sub id='5CrbQ'></sub></form><legend id='5CrbQ'></legend><bdo id='5CrbQ'><pre id='5CrbQ'><center id='5CrbQ'></center></pre></bdo></b><th id='5CrbQ'></th></span></q></dt></tr></i><div id='5CrbQ'><tfoot id='5CrbQ'></tfoot><dl id='5CrbQ'><fieldset id='5CrbQ'></fieldset></dl></div>