简体   繁体   English

python反向列表代码中的-1,-1,-1是如何工作的? 我想知道原理

[英]How is -1,-1,-1 in python reverse list code working? I would like to know the principle

I'm a python beginner and I am learning to reverse a list without using [::-1] and the reversed function.我是 python 初学者,我正在学习不使用 [::-1] 和反转函数来反转列表。 I read this explanation below but wasn't sure how the principle works.我在下面阅读了这个解释,但不确定该原理是如何工作的。 Are -1,-1,-1 in range(len(list)-1, -1, -1) working like the start, stop, step in index? range(len(list)-1, -1, -1) 中的 -1,-1,-1 是否像索引中的开始、停止、步骤一样工作? If it is, why is the second number -1 as well?如果是,为什么第二个数字也是-1? I'm posting this as I know no one to ask about coding.我发布这个是因为我知道没有人问编码。

https://stackoverflow.com/a/530507/17098889 https://stackoverflow.com/a/530507/17098889

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将此列表转换为数据框? 我想知道如何在python中做到这一点? - How to turn this list into a data frame? I would like to know how to do this in python? 我想知道如何将 map 字典的值列表设为 dataframe - I would like to know how to map dictionary with list of value to dataframe 我想知道如何在python中将ISO日期更改为UTC - I would like to know how to change an ISO date to UTC in python 我想知道如何 select 所有文件与 selenium python - I would like to know how to select all files with selenium python 您好,我想知道如何在python中使用Enum - Hello, I would like to know how to use Enum in python Python我想知道如何使用for循环编写(DictWriter) - Python i would like to know how to writerow with a for loop (DictWriter) 我想知道这在python中是否可行 - I would like to know if this is possible in python 我将如何扭转这一局面? Python 3.8 - How would I reverse this? Python 3.8 我想检查输入是否为python代码 - I would like to check if an input is python code 我想知道如何使用 Bot 框架 SDK 为 python 设置自适应卡的主机配置 - I would like to know how to set the host config of the adaptive card using Bot framework SDK for python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM