Python3 List reverse() Method
Description
The reverse() function reverses the elements in a list.
Syntax
reverse() method syntax:
list.reverse()
Parameters
- NA。
Return Value
This method has no return value, but reverses the order of the list's elements.
Example
The following example shows how to use the reverse() function:
#!/usr/bin/python3
list1 = ['Google', 'Runoob', 'Taobao', 'Baidu']
list1.reverse()
print ("列表反转后: ", list1)
The output of the above example is:
列表反转后: ['Baidu', 'Taobao', 'Runoob', 'Google']
The Python3 list