### 125. Valid Palindrome 题目: 难度: Easy 就是比较reversed string 和原本的是否相等. ```python class Solution(object): def isPalindrome(self,s): """ :type s: str :rtype: bool """ new=[] s = s.lower() for i in s: if '0'<=i<='9' or 'a'<=i<='z': new.append(i) return new == new[::-1] ``` 或者用正则,详见[re.sub()用法](http://blog.csdn.net/geekleee/article/details/75309433) 瞬间```beats 97.71%``` ```python class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ newString = re.sub("[^0-9a-zA-Z]+", "", s) return newString.lower() == newString.lower()[::-1] ```