方法一:reverse函数
a = [0,1,2,3] a.reverse() print(a)
方法二:采用切片
切片操作基本表达式:object[start_index:end_index:step]
a = [0,1,2,3] print(a[::-1])
原文地址:https://www.cnblogs.com/biu-biu-biu-/p/11560111.html
时间: 2024-10-07 21:44:18
方法一:reverse函数
a = [0,1,2,3] a.reverse() print(a)
方法二:采用切片
切片操作基本表达式:object[start_index:end_index:step]
a = [0,1,2,3] print(a[::-1])
原文地址:https://www.cnblogs.com/biu-biu-biu-/p/11560111.html