Python3 List reverse () method
description
reverse () function is used to reverse the elements in the list.
grammar
reverse () method syntax:
list.reverse()
parameter
- NA.
return value
This method does not return a value, but a list of the elements will be the reverse order.
Examples
The following example shows the reverse () function to use:
#!/usr/bin/python3 list1 = ['Google', 'w3big', 'Taobao', 'Baidu'] list1.reverse() print ("列表反转后: ", list1)
Examples of the above output results are as follows:
列表反转后: ['Baidu', 'Taobao', 'w3big', 'Google']