mycode 71.97%
class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ s = sorted(s) t = sorted(t) return s == t
参考
class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ return all([s.count(c) == t.count(c) for c in string.ascii_lowercase])
用法