Python 列表反转
1. 具体命令
分片[::-1]
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = a[::-1]
print(b)
reversed()
a =[1, 2, 3, 4, 5, 6]
c = list(reversed(a))
print(a)
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = a[::-1]
print(b)
a =[1, 2, 3, 4, 5, 6]
c = list(reversed(a))
print(a)