strip here doesn't do what you are asking for.  Do an explicit `if filename.endswith...`