strip file extension
https://docs.python.org/3/library/os.path.html#os.path.splitext splitext Try os.path.splitext it should do what you want. import os print os.path.splitext('/home/user/somefile.txt')[0]+'.jpg' | |
https://docs.python.org/3/library/os.path.html#os.path.splitext splitext Try os.path.splitext it should do what you want. import os print os.path.splitext('/home/user/somefile.txt')[0]+'.jpg' | |