Python 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/python aList = [123, 'xyz', 'zara', 'abc', 'xyz']; aList.reverse(); print "List : ", aList;
Examples of the above output results are as follows:
List : ['xyz', 'abc', 'zara', 'xyz', 123]