Copyright © tutorialspoint.com

Python Tuple tuple() Function

previous next


Description:

This function takes sequence types and convert them to tuples. This is used to convert a given list into tuple.

Syntax:

tuple( seq )

Parameters:

Here is the detail of parameters:

Return Value:

It returns the tuple.

Example:

#!/usr/bin/python

aList = (123, 'xyz', 'zara', 'abc');
aTuple = tuple(aList)

print "Tuple elements : ", aTuple

This will produce following result:

Tuple elements :  (123, 'xyz', 'zara', 'abc')

previous next

Copyright © tutorialspoint.com