Convert List To Tuple

We can convert a list to tuple by just using tuple(list_name) in Python program.

Example

>>> list = ["1", "2"]
>>> print(list)
['1', '2']
>>> print(tuple(list))
('1', '2')

Source: GeeksForGeeks

Last updated