Copyright © tutorialspoint.com

Python List reverse() Method

previous next


Description:

This method reverses objects of list in place.

Syntax:

list.reverse()

Parameters:

Here is the detail of parameters:

Return Value:

It returns none but reverse the given object from the list.

Example:

#!/usr/bin/python

aList = [123, 'xyz', 'zara', 'abc', 'xyz'];

aList.reverse();
print "List : ", aList;

This will produce following result:

List :  ['xyz', 'abc', 'zara', 'xyz', 123]

previous next

Copyright © tutorialspoint.com