reversed Python · 内置函数
返回一个倒序的迭代器,常配合 list 使用。
怎么用
reversed(序列)
小例子
print(list(reversed([1, 2, 3])))
运行结果
[3, 2, 1]
官方文档:https://docs.python.org/zh-cn/3/library/functions.html#reversed
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Python全部词条