An easy option would be to check for "." in filename
with the last character removed:
if len(filename)>1 and "." in filename[:-1]:
print("there is")
This would allow "file..", which may or may not be what you want. Another idea would be, to split filename
at every "." and check that you get at least two parts, the last of which is non-empty:
parts = filename.split(".")
if len(parts) > 1 and parts[-1]:
print("there is")
This will not allow "file..", but will allow "file.,". If you want to only allow extensions which consist of letters, you should probably use regular expressions. For example, you could try the following:
import re
m = re.match('[a-z]*\.[a-z]+', filename)
if m:
print("there is")
This will allow "file.txt", but not "a.b.c". Regular expressions are very flexible and this approach can be extended to check for quite specific name formats.