I am designing a code that requires a .fasta file to be input at one of the early stages. Right now, I am validating the input using this function: def file_validation(fasta): while True: try: file_name= str(raw_input(fasta)) except IOError: print("Please give the name of the fasta file that exists in the folder!") continue if not(file_name.endswith(".fasta")): print("Please give the name of the file with the .fasta extension!") else: break return file_name Now, although this function works fine, there is still some room for error in the sense that a user could potentially maybe input a file that, while having a file name that ends with .fasta, could have some non-.fasta content inside. What could I do to prevent this and let the user know that his/her .fasta file is corrupted? Continue reading...