There are three ways to reverse a list in Python.
在Python中可以通过三种方式来反转列表。
- List reverse() function 列出reverse()函数
- Using Slicing 使用切片
- Built-in reversed() function 内置的reversed()函数
![Python Reverse List](https://i-blog.csdnimg.cn/blog_migrate/451d0f5323f3bf4b0ee9c980790c7d14.png)
Python Reverse List
Python反向列表
Let’s look into all these ways to reverse a list through simple examples.
让我们通过简单的示例研究所有这些方法来反转列表。
使用reverse()函数的Python反向列表 (Python Reverse List using reverse() function)
skills = ['Java', 'Python', 'Android']
print(skills)
# using list reverse() function to reverse the list
skills.reverse()
print(skills)