Python: Determine if an unsorted list is contained in a 'list of lists', regardless of the order to the elements

前端 未结 4 467
鱼传尺愫
鱼传尺愫 2021-01-29 00:27

I have a similar question to this question: Determine if 2 lists have the same elements, regardless of order?

What is the best/quickest way to determine whether an unsor

4条回答
  •  星月不相逢
    2021-01-29 00:35

    If you sort given list and then append it to myListOfLists you can use this:

    if sorted(list1) in myListOfLists:
    

提交回复
热议问题