https://leetcode.com/problems/group-anagrams/

Python 3

 
class Solution:
    def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
        d = defaultdict(list)
 
        for item in strs: 
            s = "".join(sorted(item))
            d[s].append(item)
 
        return  d.values()