Python Functional tuple Method for Converting Sequences to Tuples

  • 2021-07-03 00:23:48
  • OfStack

The tuple function is similar to the list function, taking a sequence as an argument and converting it to a tuple


>>> tuple([1,2,3])
(1, 2, 3)
>>> tuple('abcd')
('a', 'b', 'c', 'd')

Related articles: