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

<tfoot id='ZisWU'></tfoot>
<legend id='ZisWU'><style id='ZisWU'><dir id='ZisWU'><q id='ZisWU'></q></dir></style></legend>

    • <bdo id='ZisWU'></bdo><ul id='ZisWU'></ul>

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

    1. python中range()函数的返回值是多少?

      What is the return value of the range() function in python?(python中range()函数的返回值是多少?)

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

        <legend id='OwBQU'><style id='OwBQU'><dir id='OwBQU'><q id='OwBQU'></q></dir></style></legend>

            <tfoot id='OwBQU'></tfoot>

                <tbody id='OwBQU'></tbody>

              • <bdo id='OwBQU'></bdo><ul id='OwBQU'></ul>
                本文介绍了python中range()函数的返回值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我认为 range() 函数会返回一个列表,其中包含您放在括号内的参数.但是当我在 IDLE 中输入 range(4) 时,我得到 range(0, 4) 作为输出.同样,当我输入 print(range(4)) 时,我也会得到 range(0, 4) 作为输出.我目前正在使用 python 3.5.

                我目前正在使用以下电子书学习 python:如何像计算机科学家一样思考",在该电子书中,它们提供了活动代码块,您可以在其中运行 python 代码.当我在那里运行 print(range(4)) 时,我确实得到了我期望的列表,即 [0, 1, 2, 3].p>

                谁能给我解释一下?

                提前致谢!

                解决方案

                您正在阅读的书可能使用 Python 2,其中 range 返回一个列表.

                在 Python 3 中,range 改为返回 不可变序列类型.

                I thought that the range() function returns a list with the arguments that you have put inside the parentheses. But when I type range(4) in IDLE, I get range(0, 4) as output. Similarly, when I type print(range(4)), I also get range(0, 4) as output. I am currently using python 3.5.

                I am currently studying python with the following eBook: "How To Think Like a Computer Scientist" and in that eBook, they provide active code blocks where you can run python code. And when I run print(range(4)) in there, I do get the list that I expected, i.e. [0, 1, 2, 3].

                Can someone explain this to me?

                Thanks in advance!

                解决方案

                The book you are reading probably uses Python 2, where range returns a list.

                In Python 3, range returns an immutable sequence type instead.

                这篇关于python中range()函数的返回值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)
              • <i id='fVSSX'><tr id='fVSSX'><dt id='fVSSX'><q id='fVSSX'><span id='fVSSX'><b id='fVSSX'><form id='fVSSX'><ins id='fVSSX'></ins><ul id='fVSSX'></ul><sub id='fVSSX'></sub></form><legend id='fVSSX'></legend><bdo id='fVSSX'><pre id='fVSSX'><center id='fVSSX'></center></pre></bdo></b><th id='fVSSX'></th></span></q></dt></tr></i><div id='fVSSX'><tfoot id='fVSSX'></tfoot><dl id='fVSSX'><fieldset id='fVSSX'></fieldset></dl></div>

                        <tbody id='fVSSX'></tbody>

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

                      • <bdo id='fVSSX'></bdo><ul id='fVSSX'></ul>
                          <tfoot id='fVSSX'></tfoot>
                          <legend id='fVSSX'><style id='fVSSX'><dir id='fVSSX'><q id='fVSSX'></q></dir></style></legend>