How to convert list of lists to tuple in Python

1 Answer

0 votes
lst = [[1,2], [3,4], [5,6]]

tpl = tuple(tuple(i) for i in lst)

print(tpl) 




'''
run:

((1, 2), (3, 4), (5, 6))

'''

 



answered Dec 15, 2023 by avibootz

Related questions

2 answers 365 views
2 answers 398 views
1 answer 213 views
1 answer 246 views
2 answers 363 views
1 answer 340 views
...