Python: converting list of lists to tuples of tuples

后端 未结 2 760
轻奢々
轻奢々 2020-12-16 12:19

A Python newbie! I need help converting a list of lists tuples of tuples.

I want to call the append_as_tuples function, but every time I return it, it says
it ca

相关标签:
2条回答
  • 2020-12-16 12:47

    To convert list_of_lists to a tuple of tuples, use

    tuple_of_tuples = tuple(tuple(x) for x in list_of_lists)
    
    0 讨论(0)
  • 2020-12-16 13:06

    there is a python built in function: list and tuple

    list( the tuple)...to conver tuple to list tuple( the list )....to convert list to tuple

    0 讨论(0)
提交回复
热议问题