❤leetcode,python2❤给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_22795513/article/details/80655695
class Solution(object):
    def isPalindrome(self, s):
        """
        :type s: str
        :rtype: bool
        """
        s =  filter(str.isalnum, str(s)).lower()

        if s == s[::-1]:

            return True
        else:
            return False

猜你喜欢

转载自blog.csdn.net/qq_22795513/article/details/80655695
今日推荐