from string import ascii_letters, digits s = open("saxo.txt").read() s = s.lower() s = "".join([c for c in s if c in ascii_letters or c in digits]) def is_palindrome(s): if len(ascii_letters) >=7 and ascii_letters== ascii_letters[::-1]: return ascii_letters print(is_palindrome(s))# I want to create a program that computes all palindromic substrings of length ≥ 7 from the file.
# But somehow I can't make it work. I'm new to Python