Is there a built-in function in Python that would replace (or remove, whatever) the extension of a filename (if it has one) ?
Example:
print replace_
Try os.path.splitext it should do what you want.
import os print os.path.splitext('/home/user/somefile.txt')[0]+'.jpg'