Next / Previous / Contents / TCC Help System / NM Tech homepage

13.37. tuple(): Convert to a tuple

To convert some sequence value S to a tuple, use this general form:

tuple(s)

The result will be a new tuple with the same elements as S in the same order.

To create an empty tuple, omit the argument. Examples:

>>> tuple()
()
>>> tuple ( ['swallow', 'coconut'] )
('swallow', 'coconut')
>>> tuple ( 'shrubbery' )
('s', 'h', 'r', 'u', 'b', 'b', 'e', 'r', 'y')
>>> tuple ( ['singleton'] )
('singleton',)