1. Remove all characters past the last dot in file name (if there are any dots) including the dot itself;
2. If there's no trailing '.spr' already, add one
Syntax: Select all
index = filename.rfind('.')
if index > 0:
filename = filename[:index]
if not filename.endswith('.spr'):
filename += '.spr'