`os.path.splitext()[0]` is how this should be done.