Pythonleetcode125. 验证回文串

class Solution:
    def isPalindrome(self, s):
        """
        :type s: str
        :rtype: bool
        """
        if(s==" "):
            return True
        str=''
        for i in s:
            if(i.isalpha() or i.isdigit()):
                str=str+i
            else:
                continue
        str=str.lower()
        #print(str)
        return (list(reversed(str))==list(str))
        

相关文章:

  • 2021-06-10
  • 2021-10-14
  • 2022-03-02
  • 2021-08-27
  • 2021-11-05
  • 2021-07-13
猜你喜欢
  • 2021-08-25
  • 2021-08-13
  • 2021-08-06
  • 2021-09-01
相关资源
相似解决方案