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

  • <i id='iKDlL'><tr id='iKDlL'><dt id='iKDlL'><q id='iKDlL'><span id='iKDlL'><b id='iKDlL'><form id='iKDlL'><ins id='iKDlL'></ins><ul id='iKDlL'></ul><sub id='iKDlL'></sub></form><legend id='iKDlL'></legend><bdo id='iKDlL'><pre id='iKDlL'><center id='iKDlL'></center></pre></bdo></b><th id='iKDlL'></th></span></q></dt></tr></i><div id='iKDlL'><tfoot id='iKDlL'></tfoot><dl id='iKDlL'><fieldset id='iKDlL'></fieldset></dl></div>
    • <bdo id='iKDlL'></bdo><ul id='iKDlL'></ul>
  • <tfoot id='iKDlL'></tfoot>
      1. <legend id='iKDlL'><style id='iKDlL'><dir id='iKDlL'><q id='iKDlL'></q></dir></style></legend>

        Python中13位数字的范围和xrange?

        range and xrange for 13-digit numbers in Python?(Python中13位数字的范围和xrange?)
        <tfoot id='jh46Z'></tfoot>

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

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

              <tbody id='jh46Z'></tbody>
              <bdo id='jh46Z'></bdo><ul id='jh46Z'></ul>

                  <legend id='jh46Z'><style id='jh46Z'><dir id='jh46Z'><q id='jh46Z'></q></dir></style></legend>
                • 本文介绍了Python中13位数字的范围和xrange?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  range()xrange() 适用于 10 位数字.但是 13 位数字呢?我在论坛中没有找到任何东西.

                  range() and xrange() work for 10-digit-numbers. But how about 13-digit-numbers? I didn't find anything in the forum.

                  推荐答案

                  你可以试试这个.与范围相同的语义:

                  You could try this. Same semantics as range:

                  import operator
                  def lrange(num1, num2 = None, step = 1):
                      op = operator.__lt__
                  
                      if num2 is None:
                          num1, num2 = 0, num1
                      if num2 < num1:
                          if step > 0:
                              num1 = num2
                          op = operator.__gt__
                      elif step < 0:
                          num1 = num2
                  
                      while op(num1, num2):
                          yield num1
                          num1 += step
                  
                  >>> list(lrange(138264128374162347812634134, 138264128374162347812634140))
                  [138264128374162347812634134L, 138264128374162347812634135L, 138264128374162347812634136L, 138264128374162347812634137L, 138264128374162347812634138L, 138264128374162347812634139L]
                  

                  另一个解决方案是使用 itertools.islice,正如 xrange 的 文档

                  Another solution would be using itertools.islice, as suggested inxrange's documentation

                  这篇关于Python中13位数字的范围和xrange?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                  <i id='QJXnR'><tr id='QJXnR'><dt id='QJXnR'><q id='QJXnR'><span id='QJXnR'><b id='QJXnR'><form id='QJXnR'><ins id='QJXnR'></ins><ul id='QJXnR'></ul><sub id='QJXnR'></sub></form><legend id='QJXnR'></legend><bdo id='QJXnR'><pre id='QJXnR'><center id='QJXnR'></center></pre></bdo></b><th id='QJXnR'></th></span></q></dt></tr></i><div id='QJXnR'><tfoot id='QJXnR'></tfoot><dl id='QJXnR'><fieldset id='QJXnR'></fieldset></dl></div>

                      <bdo id='QJXnR'></bdo><ul id='QJXnR'></ul>
                        <legend id='QJXnR'><style id='QJXnR'><dir id='QJXnR'><q id='QJXnR'></q></dir></style></legend>
                          <tbody id='QJXnR'></tbody>
                          <tfoot id='QJXnR'></tfoot>

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