reverse Python · 列表方法
把列表里的元素原地翻转顺序。
怎么用
列表.reverse()
小例子
a = [1, 2, 3] a.reverse() print(a)
运行结果
[3, 2, 1]
官方文档:https://docs.python.org/zh-cn/3/library/stdtypes.html#typesseq-mutable
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Python全部词条reverse Python · 列表方法把列表里的元素原地翻转顺序。
列表.reverse()
a = [1, 2, 3] a.reverse() print(a)
[3, 2, 1]
官方文档:https://docs.python.org/zh-cn/3/library/stdtypes.html#typesseq-mutable
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Python全部词条