Using Python, find anagrams for a list of words

前端 未结 22 872
失恋的感觉
失恋的感觉 2020-12-13 01:11

If I have a list of strings for example:

[\"car\", \"tree\", \"boy\", \"girl\", \"arc\"...]

What should I do in order to find anagrams in t

22条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 01:23

    Sort each element then look for duplicates. There's a built-in function for sorting so you do not need to import anything

提交回复
热议问题