On user input I am trying to validate they typed an appropriate file extension. For example:
file1 = input('Enter the file name ending in ".txt": ')
I'd like to validate that they entered '.txt'. Right now I'm doing very basic checking. However, the check below doesn't really validate that the file 'ends' in .txt.
if '.txt' not in file_name:
print('Include file extension (example): ".txt"')
So I suppose its validating only 'txt' characters exist after '.' but only if that is the final '.', for example, I wouldn't want it to accidentally catch on "dinosoars" in baby.dinosoars.txt.